When using Tomcat 5.5 for either development or production it is sometimes useful to have multiple instances of Tomcat running at the same time.
The instructions below allow you to set up the minimum tomcat configuration to run multiple Tomcat instances.
- Install a Tomcat 5.5 distribution. The
CATALINA_HOMEenvironment variable will point to this location. - Create a directory that will be your Catalina base, identified by the environment variable
CATALINA_BASE - Within this directory create the following directories
- logs
- conf
- webapps
- From your base Tomcat 5.5 distribution copy the following files from
$CATALINA_HOME/confto the conf directory that you have just created:- catalina.properties
- context.xml
- server.xml
- tomcat-users.xml
- web.xml
With this structure one can now run Tomcat. Open a terminal, ensure that the
environment variable CATALINA_HOME is set to point at the directory created in (1) above, set the
environment variable CATALINA_BASE to point at the directory created
in (2) above.
You can now alter the configuration files in $CATALINA_BASE/conf as
appropriate. For example edit server.xml to set the port that Tomcat will listen on.
I use this technique for running Tomcat in my development process, the
CATALINA_BASE is part of my project structure and I have ANT targets
for starting and stopping Tomcat and for deploying the application. As an example
consider the following target to start Tomcat
<target name="tomcat-start" depends="deploy" description="Starts the Tomcat application server">
<exec executable="${tomcat.home}/bin/catalina.sh">
<env key="CATALINA_HOME" value="${tomcat.home}" />
<env key="CATALINA_BASE" value="${dir.deploy}" />
<arg value="jpda" />
<arg value="start" />
</exec>
</target>

Hi John, I've also added a directory called ${catalina.base}/shared/classes/ and put my log4j.xml file in there rather then have it in the WAR file. It means you can easily edit the log settings without unpacking the WAR. The catalina.properties file defines shared/classes as a directory on the classpath for shared resources available to all deployed webapps. Simon

