- I have added tomcat 7 to my eclipse.
- When I start the server it gets started successfully(shows the message in console) but when I hit the URL http://localhost:8080 it says "404 resource not found".
- Strange thing is when I go to Tomcat bin directory and start it through start.bat, the same url http://localhost:8080 shows the tomcat homepage in browser without any issue. Any idea? Help is appreciated.
1 Answers
You need to be aware of two directory trees with Tomcat : TOMCAT_HOME
and TOMCAT_BASE
.
TOMCAT_HOME
contains binary related data and can be shared by many running Tomcat instances (it contains jar, dll, exe and other non-contextual data).
TOMCAT_BASE
specifies configuration files (ie catalina.properties
, server.xml
, context configurations), webapp directories and further files such as specific librairies if required.
When running Tomcat from his installation directory: TOMCAT_HOME
and TOMCAT_BASE
are set to same location. Then, Tomcat serves ${TOMCAT_HOME}\webapps
directory. The special ROOT
context let serve the root path and by default contains a simple webapp (browse ${TOMCAT_HOME}\webapps\ROOT
for more information).
When running Tomcat from Eclipse, Eclipse will setup two directories:
- with editable configuration (generally goes under
${WORKSPACE}\Servers\${SERVER_NAME}-conf
) - with deployed files from last describe directory, served context configuration, deployed context and some other working files such as log and work directories.
This last directory generally goes under your workspace metadata but you can edit it from the server editor. And Eclipse uses this directory as TOMCAT_BASE
. To this directory, Eclipse doesn't deploy the default ROOT
webapp neither other default ones (docs
, examples
, host-manager
and manager
). If necessary you can add them from the server configuration directory (first one described).