Open Lastone17 opened 8 months ago
I am having a very similar issue. I get the following error when I try to run the war. I get the same error if I put in an erroneous filename for updateOnStartFileName. I am completely stuck please help!
Caused by: java.util.NoSuchElementException: Cannot access first() element from an empty Iterable at org.codehaus.groovy.runtime.DefaultGroovyMethods.first(DefaultGroovyMethods.java:10425) at org.codehaus.groovy.runtime.dgm$289.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
When we migrated to Grails 6 we encountered and issue, as for grails 6.1.2 + they removed 'grails-shell' still it is required by DB plugin of 4.2.1. The only solution that we were able to find was to downgrade Grails to 6.1.1. (and wait till the 5.0 release for plugin where this issue is fixed) Our environment: grails 6.1.1 + java 17 + tomcat 9
We've been wrestling with this same issue after upgrading several of our apps to Grails 5; the solution @Lastone17 suggested worked perfectly (thanks, Lastone17!), without the issue they ran into when running under Tomcat:
implementation ('org.grails.plugins:database-migration:4.2.1') { exclude module: 'spring-boot-cli' }
Our environment is similar to theirs, except that we have:
To assist others searching for a solution to this problem, here's our full stacktrace:
SEVERE [main] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [/usr/local/tomcat/webapps/ROOT]
java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:686)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1175)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1888)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1086)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1584)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:312)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:114)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:345)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:893)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:794)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:248)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:925)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.startup.Catalina.start(Catalina.java:735)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:186)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683)
... 37 more
Caused by: java.lang.NullPointerException
at org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer.getSources(SpringApplicationWebApplicationInitializer.java:61)
at org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer.onStartup(SpringApplicationWebApplicationInitializer.java:47)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4904)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
... 38 more
Any news on Grails 6 (soon 7) support?
For Grails 6, try the following:
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.grails.org/grails/core" }
}
dependencies { // Not Published to Gradle Plugin Portal
classpath("org.grails:grails-gradle-plugin:6.2.1")
classpath("org.grails.plugins:hibernate5:8.1.0")
classpath("org.grails.plugins:database-migration:5.0.0-SNAPSHOT")
classpath("org.grails:grails-shell:6.2.1") // for database-migration
}
}
dependencies {
profile ("org.grails.profiles:web") // for grails-shell
implementation "org.grails:grails-shell:6.2.1"
implementation "org.grails.plugins:database-migration:5.0.0-SNAPSHOT"
implementation "org.liquibase:liquibase-core:4.19.1"
}
For Grails 7, the conversion work is done
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.grails.org/grails/core" }
}
dependencies { // Not Published to Gradle Plugin Portal
classpath("org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT")
classpath("org.grails.plugins:hibernate5:9.0.0-SNAPSHOT")
classpath("org.grails.plugins:database-migration:6.0.0-SNAPSHOT")
classpath("org.grails:grails-shell:7.0.0-SNAPSHOT") // for database-migration
}
}
dependencies {
profile ("org.grails.profiles:web") // for grails-shell
implementation "org.grails:grails-shell:7.0.0-SNAPSHOT"
implementation "org.grails.plugins:database-migration:6.0.0-SNAPSHOT"
implementation "org.liquibase:liquibase-core:4.27.0"
}
Steps to Reproduce
Actual Behaviour
I am aware of the issue with the plugin, so I added:
implementation ('org.grails.plugins:database-migration:4.2.1') { exclude module: 'spring-boot-cli' }
implementation 'org.liquibase:liquibase-core:4.19.0'
Also using this liquibase-core. If i run it locally in intellij everything is fine but on Tomcat i get:
liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Non-existent directory: C:\Program%20Files\Tomcat\apache-tomcat-9.0.86\webapps\<appname>\WEB-INF\classes
Environment Information