繁体   English   中英

在外部 Tomcat 服务器上运行的 Springboot 在除 index.html 之外的所有内容上都会出现错误 404

[英]Springboot running on external Tomcat server gives error 404 on everything but index.html

我基本上已经将问题确定为我正在运行的外部远程 tomcat 服务器出了点问题:其中任何将成为索引的应用程序路径(10.0.0.222:8080/demo-0.0.1-SNAPSHOT)都有效,但是过去 (10.0.0.222:8080/demo-0.0.1-SNAPSHOT/home) 导致错误 404。此路径在使用嵌入式 tomcat 服务器运行时以及在我的本地主机上运行外部 tomcat 服务器时有效,所以我很确定问题出在我的远程 tomcat 服务器上。 我不知道是什么原因造成的,所以我很感激任何帮助,如果我可以提供更多信息/文件,请告诉我。

I have this problem with my spring boot project where the application runs fine when using the embedded tomcat server, but when I compile and package the project as a war in order to deploy it on my external tomcat server, I can't send requests to它和主要方法中的代码不运行 https://github.com/louisspaghetti/demo

一些注意事项:当我将它部署到外部 tomcat 时/当我在 tomcat 上启动它时没有错误。

使用嵌入式 tomcat 运行时,我能够向 localhost:8080/home 发送请求,但对 10.0.0.222:8080/demo-0.0.1-SNAPSHOT/home 的请求(访问外部 tomcat)会导致错误 404。

I have another project on the tomcat server that I made with raw java servlets and it runs fine, so I don't think it's a problem with my tomcat config but I guess it could be...

编辑:我为“/”添加了另一个映射以返回 index.html 并且有效但“/home”(或 10.0.0.222:8080/demo-0.0.1-SNAPSHOT/home)仍然不起作用

编辑 2:该应用程序在我最近在本地主机上创建的 tomcat 服务器上运行时使用 /home 路径。 我之前在远程 tomcat 服务器上使用的另一个应用程序现在只能与 index.html 一起使用,这也让我相信这一定是服务器的问题? 有谁知道我必须做些什么来解决这个问题?

修复:使用 Tomcat 9 而不是 10

我找到了解决方法:使用 tomcat 9 而不是 10

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM