Open miguelabautista opened 2 years ago
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:
If the database-migration plugin is included, the initializers are the following:
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: https://github.com/grails/grails-core/issues/12183
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).
@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' }
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
Example Application
https://github.com/miguelabautista/database-migration-sample