HTTP 状态 404 - 请求的资源 (/ProjectName/) 不可用 [英] HTTP Status 404 - The requested resource (/ProjectName/) is not available
问题描述
在 Tomcat 服务器上运行我的 Eclipse 项目时出现以下错误:
I'm getting the following error when running my Eclipse project on Tomcat server:
HTTP 状态 404 - 请求的资源 (/ProjectName/) 不可用.
HTTP Status 404 - The requested resource (/ProjectName/) is not available.
浏览器地址栏中的 URL 是 http://localhost:8080/ProjectName/
.
The URL in browser's address bar is http://localhost:8080/ProjectName/
.
我真的不知道我的文件中缺少什么.我在 /WebContent
文件夹中有一个 Index.jsp
,我的 web.xml
包含以下条目:
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>
推荐答案
默认情况下,当您以 http://localhost:8080/ProjectName/
而不是物理方式打开项目根文件夹时http://localhost:8080/ProjectName/Index.jsp
中的文件,然后服务器将在 web.xml
中查找欢迎文件.如果没有找到,那么你会得到这个 404页面未找到".错误.
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.
就您而言,网址和文件名区分大小写.您将 index.jsp
声明为欢迎文件,但您提到您有一个 Index.jsp
.将其重命名为 index.jsp
,然后您就可以通过这种方式使用欢迎文件打开 web 应用程序的上下文根.
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.
这篇关于HTTP 状态 404 - 请求的资源 (/ProjectName/) 不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!