views:

121

answers:

1

Hi everybody,

When I run tomcat from the windows tray, it starts and I cant reach http://localhost:8080/ Tomcat homepage, but if I run it from Eclipse, it works, my applications works, but I cant reach the http://localhost:8080/...

how to solve it? or is it normal?

Thanks!

+1  A: 

This maybe normal, according to this thread:

This is normal.
To see why, double-click on the Tomcat server in the Servers view. This will open the Tomcat configuration editor. Click on the "Open launch configuration" link in the Overview section. This will open the launch configuration properties dialog. Select the Arguments tab and examine the contents of the VM Arguments field.

Note that the catalina.home property points to your Tomcat installation, but catalina.base points to a ".metadata\.plugins\org.eclipse.wst.server.core\tmp" directory under your workspace.
Thus, you are running a separate instance of Tomcat. The "webapps" directory under the ".metadata\...\tmp" directory contains only an "empty" ROOT webapp plus any web projects you have added to the server. This is why you get the 404.

In the Tomcat configuration editor, you can uncheck the "Run modules directly from the workspace (do not modify the Tomcat installation)" option and catalina.base and catalina.home will both be set to your Tomcat installation.
Be aware that in this configuration, the Tomcat server in Eclipse "owns" your Tomcat installation.
Every time you start the Tomcat server from Eclipse, the Tomcat files under the Servers project in your workspace will overwrite the files in your installation.

It was assumed the most would want to keep their Tomcat installation independent from Eclipse Tomcat server, so the default is to create a separate Tomcat instance.
With separate instances, you can run the Tomcat installation at the same time as the Eclipse Tomcat server provided you modify one or both of them so that the ports they use do not conflict.

If you would like the standard Tomcat webapps present while keeping the separate Tomcat instance in Eclipse, switch to the Modules tab in the Tomcat configuration editor and use the "Add External Web Module" button to manually add the desired webapps. Note that this will add a little bit to the startup time for the server.

VonC
Thanks for the great answer!
Milan