You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so, --dataSource actually overrides the dataSource configuration for the primary dataSource with a string
and that again results in the follwing stacktrace because the dataSource config is now broken
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: wrong number of arguments
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300)
... 101 common frames omitted
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
at org.grails.datastore.mapping.config.ConfigurationBuilder.buildRecurse(ConfigurationBuilder.groovy:360)
at org.grails.datastore.mapping.config.ConfigurationBuilder.buildRecurse(ConfigurationBuilder.groovy:286)
at org.grails.datastore.mapping.config.ConfigurationBuilder.buildRecurse(ConfigurationBuilder.groovy:286)
at org.grails.datastore.mapping.config.ConfigurationBuilder.buildInternal(ConfigurationBuilder.groovy:111)
at org.grails.datastore.mapping.config.ConfigurationBuilder.build(ConfigurationBuilder.groovy:92)
at org.grails.orm.hibernate.connections.HibernateConnectionSourceSettingsBuilder.build(HibernateConnectionSourceSettingsBuilder.groovy:37)
at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.buildSettings(AbstractHibernateConnectionSourceFactory.java:70)
at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.buildSettings(AbstractHibernateConnectionSourceFactory.java:23)
at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:63)
at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52)
at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24)
at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:200)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
... 103 common frames omitted
misc
unfortunately, there is no way to use SpringApplication#setAddCommandLineProperties(false) because GrailsApplicationContextCommandRunner does not allow customization
i guess there are two more or less obvious solutions to this issue:
add an alternative name to --dataSource like --dbmDataSource
this change would be within this plugin
or: support GrailsApplicationContextCommandRunner customization
that would have to happen in grails-core
workaround
using the grails shell/cli directly.
that does not use GrailsApplicationContextCommandRunnerbut invokes the command class directly.
however, the grails-cli has other issues like it is non-trivial to pass system properties along.
ideally, it should be possible to use the database-migration plugin with gradle only, not having a need for the grails shell/cli at all.
Environment Information
Operating System: winx64
Grails Version: 4.0.1
Plugin Version: 3.0.4
Database: postgresql-12
JDK Version: openjdk-11
Example Application
n/a
The text was updated successfully, but these errors were encountered:
Task List
Steps to Reproduce
dbmGormDiff
via gradle with-Pargs=--dataSource=mySecondDs
Expected Behaviour
no exception
Actual Behaviour
--dataSource
arg is processed byCommandLinePropertySource
which is added bySpringApplication#configurePropertySources
by default--dataSource
actually overrides thedataSource
configuration for the primary dataSource with a stringmisc
SpringApplication#setAddCommandLineProperties(false)
becauseGrailsApplicationContextCommandRunner
does not allow customizationi guess there are two more or less obvious solutions to this issue:
--dataSource
like--dbmDataSource
GrailsApplicationContextCommandRunner
customizationworkaround
using the grails shell/cli directly.
that does not use
GrailsApplicationContextCommandRunner
but invokes the command class directly.however, the grails-cli has other issues like it is non-trivial to pass system properties along.
ideally, it should be possible to use the database-migration plugin with gradle only, not having a need for the grails shell/cli at all.
Environment Information
Example Application
n/a
The text was updated successfully, but these errors were encountered: