0

I installed eclipse with 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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Daniel S.
  • 151
  • 2
  • 8
  • possible duplicate of [Tomcat started in eclipse but unable to connect to link to http://localhost:8085/](http://stackoverflow.com/questions/2280064/tomcat-started-in-eclipse-but-unable-to-connect-to-link-to-http-localhost8085) – BalusC Sep 02 '11 at 19:01
  • What's that "apache site" that's supposed to be served by your Tomcat under `localhost:8080` and why do you need/want it to be there? You usually use a local Tomcat instance just to test **your app**. – Philipp Reichart Sep 02 '11 at 20:14
  • @Philipp: the Tomcat default homepage. Why he needs it is also beyond me. – BalusC Sep 02 '11 at 20:19

1 Answers1

2

Assuming it's the regular "Congratulations, you've managed to start Tomcat"-page and you really want it for your Eclipsed-managed Tomcat instance:

  1. Double-click your Tomcat in the Eclipse "Servers" view
  2. At the bottom of the view that just opened, select "Modules"
  3. Click "Add External Web Module" and browse to the directory where you extracted your Tomcat, there select webapps/ROOT, press OK
  4. 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.

Philipp Reichart
  • 20,771
  • 6
  • 58
  • 65