且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HTTP状态404 - 请求的资源(/ ProjectName /)不可用

更新时间:2022-10-19 15:58:25

默认情况下,当您打开项目根文件夹在 http:// localhost:8080 / ProjectName / 中,而不是在 http:// localhost:8080 / ProjectName / Index.jsp中的物理文件,则服务器将在 web.xml 中查找欢迎文件。如果没有找到,那么你会得到这个404页面未找到错误。



在你的情况下,URL和文件名是区分大小写。您声明了 index.jsp 作为欢迎文件,但您提到您有一个 Index.jsp 。将其重命名为 index.jsp ,然后您可以使用欢迎文件打开webapp的上下文根目录。



另见:




I'm getting the following error when running my Eclipse project on Tomcat server:

HTTP Status 404 - The requested resource (/ProjectName/) is not available.

The URL in browser's address bar is http://localhost:8080/ProjectName/.

I really don't know what is missing in my files. I have an Index.jsp in the /WebContent folder and my web.xml contains below entry:

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

By default, when you open the project root folder as in http://localhost:8080/ProjectName/ instead of a physical file as in http://localhost:8080/ProjectName/Index.jsp, then the server will lookup for a welcome file in web.xml. If none is found, then you'll get this 404 "Page not found" error.

In your case, URLs and file names are case sensitive. You declared index.jsp to be the welcome file, but you mentioned that you've an Index.jsp. Rename it to index.jsp and then you'll be able to open the webapp's context root with the welcome file this way.

See also: