Home > OS >  How to run a Grails 5.1.7 application on a Tomcat 9.0.44 server - HTTP 404
How to run a Grails 5.1.7 application on a Tomcat 9.0.44 server - HTTP 404

Time:06-10

My old application with grails version 4.0.5 used to run perfectly. After being forced to update gradle I wasnt able to make it even compile. Then, I created a new project with grails 5.1.7, updated the build.gradle file with the new commands and finally it compiled. The application runs fine in my computer with:

grails run-app

However, when I make and run the .war file created with the command:

grails war

in my tomcat server, I get no errors on deployment, but http request always get an HTTP 404 error.

So I decided to make a new vanilla 5.1.7 grails project and try to make a new clean war. This new project also runs perfectly on my computer with run-app and also is deployed with no errors but also shows the HTTP 404 error with you try to retrieve a page.

I have been reading on grails documentation that grails war command makes a embedded container and could cause problems on tomcat:

https://docs.grails.org/latest/guide/deployment.html#deploymentStandalone

So, I tried to follow the advice and remove from build.gradle:

implementation  "org.springframework.boot:spring-boot-starter-tomcat"

But still no luck, I keep getting the HTTP 404 error.

Summary:

My grails 4.0.5 application ran just fine creating the war file with "grails war", so I am not sure if this "embeddable" is the cause of the problem. Due to I get no errors I have no clue.

Any help would be appreciated

Machines and software I've tested:

Machine 1:

  • Ubuntu 20.10
  • Apache tomcat 9.0.44
  • openjdk version "11.0.11"

Machine 2:

  • Windows 10
  • Apache tomcat 10.0.10
  • openjdk version "11.0.11"

Same result on both.

I have also tried to add: ext['tomcat.version'] = '10.0.10' to gradle in case. Not working.

CodePudding user response:

I managed to run the Grails 5 application on Tomcat 8 and Tomcat 9 by updating the JVM version from 11 to 16. It seems like Grails 5 doesnt support Tomcat 10.

  • Related