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

Exception deploying war in tomcat with version 4.0.0 #268

Open
miguelabautista opened this issue Jan 20, 2022 · 4 comments
Open

Exception deploying war in tomcat with version 4.0.0 #268

miguelabautista opened this issue Jan 20, 2022 · 4 comments

Comments

@miguelabautista
Copy link

miguelabautista commented Jan 20, 2022

Tomcat throws an Exception when using new version

NOTE: If I use version 3.1.0 the app is deployed correctly

Exception:

SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [E:\apache-tomcat-9.0.33\webapps\prueba.war]
java.lang.IllegalStateException: Error starting child

see logger file for full logger.

Environment Information

  • Operating System: windows 11
  • Grails Version: 5.1.2
  • Plugin Version: 4.0.0
  • JDK Version: java 8
  • Tomcat Version: 9.0.56

Example Application

https://github.com/miguelabautista/database-migration-sample

@miguelabautista
Copy link
Author

logger.txt

@miguelabautista miguelabautista changed the title app exception in tomcat with version 4.0.0 Exception deploying war in tomcat with version 4.0.0 Jan 20, 2022
@davidkron
Copy link

We are experiencing the exact same error in our application and are therefore currently not upgrading to the newest version.
The problem only surfaces when deploying to an external Tomcat, run-app is not affected.

I did some debugging and I managed to track the difference (with and without database-migration plugin) of the execution to the following lines:
https://github.com/spring-projects/spring-framework/blob/v5.3.15/spring-web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java#L172-L174

Without database-migration plugin, the following initializers are present:

  • org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.JerseyWebApplicationInitializer
  • ApplicationLoader (this class seems to be automatically generated by Grails)

If the database-migration plugin is included, the initializers are the following:

  • org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.JerseyWebApplicationInitializer
  • org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer
  • ApplicationLoader

So the culprit seems to be SpringApplicationWebApplicationInitializer, which is also where the NullPointerException is thrown. This class belongs to the project spring-boot-cli and is included through the following dependency chain of the database-migration plugin:

./gradlew dependencyInsight --dependency spring-boot-cli
...
org.springframework.boot:spring-boot-cli:2.6.2
\--- org.grails:grails-shell:5.1.2
     \--- org.grails.plugins:database-migration:4.0.0 (requested org.grails:grails-shell)
          \--- compileClasspath

This also includes grails-shell, which shouldn't belong in an application artifact.

I think this might be related to this issue which I opened:
grails/grails-core#12183

davidkron added a commit to davidkron/grails-database-migration that referenced this issue Feb 2, 2022
@rilisema
Copy link

rilisema commented Mar 5, 2022

Can someone tell me which settings work for grails 5.1.2? I am experiencing this issue also. Version 4.0.1-SNAPSHOT is not working, neither does 4.0.0. When I try to go back to version 3.0.4 I get another error (java.lang.NoClassDefFoundError: org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger).

@miguelabautista
Copy link
Author

miguelabautista commented Mar 18, 2022

@davidkron Please test with the new version (4.1.0) I have the same error.

in my case if I do this it works:

implementation('org.grails.plugins:database-migration:4.1.0') {
exclude module: 'spring-boot-cli'
}

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

3 participants