且构网

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

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

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

你期待什么?默认的Tomcat主页?如果是这样,您需要配置Eclipse以从Tomcat进行控制。



双击服务器选项卡中的Tomcat服务器条目,您将得到服务器配置。在左侧列中,在服务器位置下,选择使用Tomcat安装(注意,当它变灰时, ))。这样,Eclipse将完全控制Tomcat,这样,当您从Eclipse中运行时,您也可以使用Tomcat Manager访问默认的Tomcat主页。我在开发使用Eclipse时看不出有用的方法。





端口号不是问题。否则在Tomcat的启动日志中会出现异常,浏览器会显示特定于浏览器的连接超时错误页面(因此Tomcat特定的错误页面不会在Tomcat未启动并运行时无法提供) )


I integrated Tomcat 7 in Eclipse. When I start it using Eclipse, it shows that Tomcat is up and running, but when I go to http://localhost:8080 in my browser, it gives me following error:

HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.

Apache Tomcat/7.0.23

I tried changing the port in server.xml just in case if 8080 is used by another service, but it didn't work either. How can I solve it?

What are you expecting? The default Tomcat homepage? If so, you'll need to configure Eclipse to take control over from Tomcat.

Doubleclick the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation (note, when it is grayed out, read the section leading text! ;) ). This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse.

The port number is not the problem. You would otherwise have gotten an exception in Tomcat's startup log and the browser would show a browser-specific "Connection timed out" error page (and thus not a Tomcat-specific error page which would impossibly be served when Tomcat was not up and running!)