-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
Grails 6 won't run from a war file. #13130
Comments
I don't think wars are runnable by default. Are you sure you wouldn't rather have a runnable jar? |
@codeconsole, we do use bootWar to create the war file. The "java -jar MyWar.war" command works using Grails 5, but does not work for Grails 6. Our main use case is having our users install the application on their local infrastructure using an installer utility. This installer ultimately uses org.springframework.boot.loader.WarLauncher to launch and startup the application. |
It sounds like you are missing the following in your
|
Unfortunately adding launchScript() to the bootWar task did not help. We still get those "Could not resolve view with name" errors. |
It has to be something specific to your environment. The following works fine for me:
Perhaps you should start with a very simple sample app like I just created above and try to isolate what is causing the problem? |
The application builds successfully and starts running with the "Grails application running at http://localhost:8080 in environment: production" message, but the errors arise when I attempt to access the application at localhost:8080 using the Chrome browser. I'll look into creating a smaller app to see if anything shakes out. |
@msaubier please create an app exactly how I did above and let me know if it works. |
I installed Grails locally on my laptop (we normally just use the IntelliJ plugin) and created a sample application using your steps. Here are the results after creating the app and attempting to access it from Chrome.
|
Strange, what are the contents of your war? Mine are:
|
I've also tried jdk 11 with no issues on Chrome or Safari
|
Here are the contents of my war file.
|
I was hoping to also see the file sizes. Do the total sizes and # of files match up?
|
I found some PowerShell commands to provide information about file sizes and count. There are definitely differences.
|
I put together the attached spreadsheet to compare the files in your war file to the ones in my war file. Looks like the total difference in the number of files is 21. There is a legend at the top of the attached spreadsheet...yellow highlighted filenames don't exist in the other war file, while orange highlighted filenames exist in both war files but with different version numbers. Hopefully this comparison helps us figure out what's going on. |
Hi @msaubier, that actually makes things look a bit obvious. Your war is missing all the compiled jsp pages. |
can I see your |
Are you sure you are not running Grails 6.0.0-RC1 ? |
Sounds like you are using the RC1 version of the grails-gradle-plugin? The version of the plugin is defined in |
Here are the |
Can I also see |
Here is my build.gradle You are missing tasks.withType(War).configureEach { War war ->
war.dependsOn compileGroovyPages
} |
bootWar fails when I add that tasks.withType(War) change to build.gradle. Here's the stacktrace.
|
Also, I don't see a |
@msaubier I am not understanding why your Can you try running mine?
I can see you have uncompiled
|
Your "website" test application works for me. I had to replace the Running I've noticed when I create a test application (using the binary download like before) I end up with Gradle 7.2 in the project, instead of Gradle 7.6.2. I don't know if that makes a difference. |
sorry, I meant to say You could try just using the same |
I downloaded the binary file from https://grails.org/download.html on Monday, so it should be up-to-date. |
Can you paste the output of
|
Here is a freshly created test app with the information you are looking for. My GRAILS_HOME environment variable is set to the Grails 6 binary I downloaded and unzipped from https://grails.org/download.html on Monday
|
Strange, I am using the grails 6.0.0 distribution from sdkman and I can confirm it produces a completely different app than the one from https://grails.org/download.html |
So apparently the downloadable distribution is completely different from the one I am using and therefore produces different results using the You can see the differences here and adjust your app accordingly to get it working |
Thank you for all of your help, @codeconsole!!! My upgraded application seems to be working now, although we have much more testing to perform. I was able to resolve the issue in this ticket, however, by reviewing the differences between our test applications...mainly updates to build.gradle, gradle.properties, and settings.gradle. |
It seems that grails 6 added a new clause to the default build.gradle: tasks.withType(War).configureEach { War war ->
war.dependsOn compileGroovyPages
} This was not present in grails 5 default build.gradle. Subsequently, anyone upgrading from Grails 5 will need to add that clause. This is not present in the grails 6.0.0 upgrading notes: https://docs.grails.org/6.0.0/guide/single.html#upgrading |
@gschueler yeah, I had mentioned that previously above but it did not resolve his issue. |
@codeconsole thanks, I ran into the same issue and that is what fixed it for me, and I was just pointing out that the docs don't mention it. |
@gschueler yeah, thanks. I agree it should have been added to documentation. The only reason I found out about it is that I keep track of the differences of I don't think this should be requirement, I just created a ticket to ask for it added automatically by the plugin: |
This should be resolved with Grails 6.1.0 |
Expected Behavior
We are attempting to upgrade a Grails application from 5.3.2 to 6.0.0. If we simply set grailsVersion=6.0.0 and grailsGradlePluginVersion=6.0.0 in the gradle.properties file, the upgraded application runs fine using "run-app" from IntelliJ or "./gradlew bootRun" from the terminal within IntelliJ.
If we generate a war file using the grails "package" command and deploy the war file or attempt to run the war file from the command line using the "java -jar MyWar.war" command, the application successfully starts up but we receive "could not resolve view" errors attempting to access the application.
Seems related to #12173, but the war file doesn't run even if we run the "java -jar MyWar.war" command from the same directory as the war file.
Attached is a sample of the log file.
error-log.txt
Actual Behaviour
The application runs without error.
Steps To Reproduce
No response
Environment Information
Windows operating system. Java 11. Using the embedded Tomcat server to run the application. Neo4j 3.5 database.
Example Application
No response
Version
6.0.0
The text was updated successfully, but these errors were encountered: