tags:

views:

26

answers:

2

I am very new to Tomcat and web development in general and apologize for what may be a very silly question.

Consider 2 situations:

1.

I start Tomcat outside of Eclipse.
I use eclipse to create a war file.
I deploy it via admin console.
All is ok

2.

I start Tomcat via Eclipse
I can't access admin console

http://localhost:8080/manager/html greets me with 404 error
Same page is behaving properly when Tomcat is started outside of Eclipse

Please advise

Why might the issue be?

A: 

Eclipse creates a new Tomcat configuration separate to your Tomcat installation, in the 'Servers' project. This allows Eclipse to deploy webapps without interfering with anything you've done in your installation (via the manager app or by editing config files manually).

You can reconfigure Eclipse so that it uses the config from your Tomcat installation (see Pascal's answer), or to re-enable the manager app - but read the WTP Tomcat FAQ first as there are good reasons for it working the way it does. I don't recall ever needing to do this - the 'Servers' tab in Eclipse lets you deploy/start/stop/debug/configure apps as required.

SimonJ
OK, but when i start/ stop Tomcat via eclipse or outside of eclipse- we are dealing with the same instance of the web server, right? In that respect shouldn't same URL work? Just curious
mac
Not really. Tomcat is just a 'container' for Java web applications - the URLs it responds to depend on which apps you've configured it to run. An 'instance' is really a combination of the Tomcat code (there's one copy of this - wherever you installed Tomcat) and the configuration (server.xml, webapps/ directory, etc.) which there can be multiple copies of. The manager is just another web application whose purpose is to add/remove stuff from the webapps/ directory, and since Eclipse does this job for you, Eclipse disables the manager when it creates a Tomcat instance in the 'Servers' project.
SimonJ
+1  A: 

Why might the issue be?

You need to configure Eclipse to take control of your Tomcat installation. To do so:

  • double click on the Tomcat Server in the Servers view
  • under Server Locations, select Use Tomcat installation

This is illustrated on the screenshot below:

alt text

Pascal Thivent