java – Tomcat 404错误:源服务器没有找到目标资源的当前表示,或者不愿意透露存在该表示
参见英文答案 > Servlet returns “HTTP Status 404 The requested resource (/servlet) is not available”                                    8个
我正在关注o7planning的教程,并在第6步陷入困境:

http://o7planning.org/en/10169/java-servlet-tutorial

这只是一个显示HelloWorld的简单项目,但出于某种原因我一直收到404错误.详情:

enter image description here
但是Tomcat欢迎页面显示正确.

Tomcat welcome page

这里到目前为止我尝试过的解决方案(并且它们不起作用):

Right-click project -> properties -> Project Facets -> Runtimes -> checked “Apache Tomcat v9.0” -> Apply -> finish.

Server tab -> Right-click “Tomcat v9.0…” -> properties -> switch location -> Choose “Use tomcat installation” on “Server locations” panel.

最佳答案
问题解决了,我没有添加index.html.在web.xml中指出了哪一点

enter image description here

注意:项目可能有多个web.xml文件.

如果有另一个web.xml

src/main/webapp/WEB-INF

然后你可能需要添加另一个索引(这次是index.jsp)

src/main/webapp/WEB-INF/pages/

点击查看更多相关文章

转载注明原文:java – Tomcat 404错误:源服务器没有找到目标资源的当前表示,或者不愿意透露存在该表示 - 乐贴网