I installed eclipse w开发者_运维问答ith tomcat 7. I start tomcat from eclipse and it works when i access my own projects within the browser
localhost:8080/ReadFormData/Form.html
but what's strange is that when i type within the browser:
localhost:8080
it doesn't access the apache site. I get the following error status:
HTTP Status 404 - /
type Status report
message /
description The requested resource (/) is not available.
When i close eclipse and i start the server from outside and type
localhost:8080
it works. I know it's not a big deal but it's kind of frustrating.
Assuming it's the regular "Congratulations, you've managed to start Tomcat"-page and you really want it for your Eclipsed-managed Tomcat instance:
- Double-click your Tomcat in the Eclipse "Servers" view
- At the bottom of the view that just opened, select "Modules"
- Click "Add External Web Module" and browse to the directory where you extracted your Tomcat, there select
webapps/ROOT
, press OK - Keep the "Path" field as
/
(single slash), press OK
If you now start your Tomcat from within Eclipse, you'll find that http://localhost:8080
works just like when you start Tomcat from outside Eclipse.
Now for the slightly more interesting reason behind this:
Eclipse very strictly controls what's going on in server instances managed by it, so it only runs with the contexts/web apps you explicitly add (see steps 1.-4. above).
When starting Tomcat from outside Eclipse, it runs any context it finds in its webapps
directory; this usually includes the ROOT
webapp (mentioned above), manager
, host-manager
, docs
and examples
.
精彩评论