如何在Tomcat 9.0.44服务器上运行Grails 5.1.7应用程序-HTTP 404
我使用Grails版本4.0.5的旧应用程序用于完美运行。被迫更新Gradle后,我无法编译它。然后,我创建了一个带有Grails 5.1.7的新项目,并使用新命令更新了build.gradle文件,最后对其进行了编译。该应用程序在我的计算机中运行正常:
grails run-app
但是,当我使用命令创建并运行创建的.war文件时:
grails war
在我的Tomcat服务器中,我没有部署错误,但是HTTP请求始终获得 http 404 错误。
因此,我决定制作一个新的香草5.1.7 Grails项目,并尝试进行新的清洁战争。这个新项目也可以在我的计算机上完美运行,并通过Run-App完美地运行,并且没有错误,但还显示 HTTP 404 错误,您尝试检索页面。
我一直在阅读有关 Grails Wars Wars War 命令的文档的文档,可以在tomcat上引起问题:
>从build.gradle中删除:
implementation "org.springframework.boot:spring-boot-starter-tomcat"
但仍然没有运气,我一直在 http 404 错误。
摘要:
我的Grails 4.0.5应用程序可以使用“ Grails War”创建战争文件,因此我不确定此“可嵌入”是否是造成问题的原因。由于我没有错误,所以我没有任何线索。
任何帮助都将不胜感激
我已经测试过的
:机器1:
- ubuntu 20.10
- apache tomcat 9.0.44
- OpenJDK版本“ 11.0.11”
机器2:
- Windows 10
- Apache Tomcat 10.0.10
- ”
OpenJDK版本11.0.0.0.11 两个都。
我还试图添加: ext ['tomcat.version'] = '10 .0.10'
在gradle的情况下。不起作用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法通过将JVM版本从11到16更新,在Tomcat 8和Tomcat 9上运行了Grails 5应用程序。似乎Grails 5不支持Tomcat 10。
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.