问题描述
我遵循了o7计划的教程,并被困在第6步:
o7planning.org/en/10169/java-servlet-tutorial
这只是一个简单的项目,显示HelloWorld,但由于某些原因我不断得到404错误。详细信息:
-
HTTP状态404 - 未找到
类型状态报告
消息/ ServletTutorial /
描述源服务器没有找到目标资源的当前表示,或者不愿意披露一个存在。
更新更新:项目可能有多个web.xml文件。
如果
src / main / webapp / WEB-INF
中的另一个web.xml然后,您可能需要添加另一个索引(此时index.jsp)到
src / main / webapp / WEB-INF / pages /
I've followed the tutorial on o7planning and got stuck in step 6:
o7planning.org/en/10169/java-servlet-tutorial
It's just a simple project that show HelloWorld but for some reason I keep getting 404 error. Detail:
--HTTP Status 404 – Not Found
Type Status Report
Message /ServletTutorial/
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
However the Tomcat welcome page showing properly.
Here solutions that I've tried so far (and they are NOT working):
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.
Problem solved, I've not added the index.html. Which is point out in the web.xml
Update:
More update: a project may have more than one "web.xml" file.
if there are another "web.xml" in
src/main/webapp/WEB-INF
Then you might need to add another index (this time index.jsp) to
src/main/webapp/WEB-INF/pages/
这篇关于Tomcat 404错误:原始服务器没有找到目标资源的当前表示,或者不愿意透露该目录的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!