Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration not working with Grails 6 on Tomcat 9 #353

Open
Lastone17 opened this issue Mar 14, 2024 · 3 comments
Open

Migration not working with Grails 6 on Tomcat 9 #353

Lastone17 opened this issue Mar 14, 2024 · 3 comments

Comments

@Lastone17
Copy link

Steps to Reproduce

  1. build war (grails war)
  2. try to deploy war on tomcat

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

  • Operating System: Windows
  • Tomcat: 9.0.86
  • liquibase: 4.19.0
  • Grails Version: 6.1.2
  • Plugin Version: 4.2.1
  • Database: mysql
  • JDK Version: 11
@keithdv
Copy link

keithdv commented Apr 18, 2024

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)

@galexey1986
Copy link

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

@logantracyo
Copy link

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:

  • Ubuntu Linux instead of Windows
  • Grails 5 instead of 6
  • Postgres instead of MySQL

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants