Setting up the Application Server: Tomcat

Download the latest Tomcat version from https://tomcat.apache.org/download-70.cgi and unpack  it to a directory of your choice. I used /opt/apache-tomcat-7.0.22. Then, setup the Tomcat server in Eclipse: open “Window => Preferences” and select the “Server => Runtime Environments” node in the tree:

Press the “Add” button to create a new Server Runtime Environment:

Select “Apache Tomcat v7.0”, make sure that “Create new local server” is checked  and press “Next >”

Press “Finish” – the new runtime environment is now listed in the available runtime environments:

Press “Ok” to close the preferences Window.

Note the newly created project “Servers” in your workspace. This project contains the configuration files from Tomcat’s “conf” directory. When starting tomcat, these files are copied to some temporary location within the .metadata directory of your workspace (like .metadata/.plugins/org.eclipse.wst.server.core/tmp0). tmp0 is used as the CATALINA_BASE directory and also contains the conf, logs, temp, webapps and work directory. So all the working files for tomcat are maintained in this directory, and tomcat is launched so that it takes them from there. Note that, when creating the application server in eclipse, eclipse needs at least read access to the files in the conf directory of the tomcat installation to copy them into the Server project. Otherwise an error will be displayed later when trying to start tomcat. When looking up a running tomcat process, this is how it has been started:

/usr/lib/jvm/java-6-sun-1.6.0.24/bin/java
  -Dcatalina.base=/home/andreas/webworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
  -Dcatalina.home=/opt/apache-tomcat-7.0.22
  -Dwtp.deploy=/home/andreas/webworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps 
  -Djava.endorsed.dirs=/opt/apache-tomcat-7.0.22/endorsed -Dfile.encoding=UTF-8
  -classpath /opt/apache-tomcat-7.0.22/bin/bootstrap.jar:/opt/apache-tomcat-7.0.22/bin/tomcat-juli.jar:
             /usr/lib/jvm/java-6-sun-1.6.0.24/lib/tools.jar org.apache.catalina.startup.Bootstrap start