MITI - Multiple Instances Tomcat Installer

MITI - Multiple Instances Tomcat Installer

No software patents

What is it all about?

The Multiple Instances Tomcat Installer helps performing the installation of multiple Apache Tomcat instances (analogous to You may want to install your Tomcats this way if you host more than one web site on a single machine and want to use the same Tomcat version throughout all sites. The main advantage is that your services are independent from each other due to this setup style.

Based on the information given in a configuration file and at the command line, MITI will create a new $CATALINA_BASE, i.e. an individual directory for a Tomcat service including configuration files.

The TCP ports in the service's server.xml will be updated with sed according to data stored in a ports database file in order to be unique on a system. The ports database will be named ports.txt.

The script will also create a start script for running each Tomcat instance as an operating system service. The OS service utilises jsvc to run the service under a specific user. Jsvc is also known as Commons-Daemon (just in case it doesn't get shipped with your version of Tomcat).

This script was tested with Tomcat 5.0.x on Debian Woody and Sarge. It does not seamlessly work together with 4.1.x (Many more things must be edited manually and jsvc is not always shipped with it).

  • Download a binary Tomcat 5 distribution in .tar.gz format from the Apache Jakarta Project.
  • Unpack the archive and move it to where you want to have your $CATALINA_HOME (I place mine under /usr/local/tomcat).
  • Download MITI and place it where you will find it again (e. g. to $CATALINA_HOME).
  • Compile jsvc distributed with Tomcat and copy to your $CATALINA_HOME (for Tomcat 4 the script ist called
  • Edit the script that comes with jsvc (search $CATALINA_HOME/bin/jsvc-src/native) to fit your environment.
    • You must add a new parameter line to the jsvc call: "-Dcatalina.base=$CATALINA_BASE \"
    • The tmpdir ought to be unique for each instance:
      • Create a parameter TMP_DIR=/usr/local/tomcat/instances/$INSTANCE_NAME/temp
      • Adapt the parameter in the jsvc call:$TMP_DIR \
    • The pid-file in /var/run needs to be tuned in order to have one file per instance:
      • Create a parameter PIDFILE=/var/run/jsvc-$
      • Add a line with "-pidfile $PIDFILE \" to the parameters for the jsvc call in the start section.
      • change the stop case to
        # Stop Tomcat
        PID=`cat $PIDFILE`
        if [ -n $PID ]
        kill $PID
        rm $PIDFILE
  • Copy the script to the location specified by the TOMCATSCRIPT_LOCATION parameter in miti.conf.
  • Edit the miti.conf file to fit your environment.
  • You may want to add a dedicated tomcat user and group to run the services for reasons of security (and don't forget to set the TOMCAT_USER accordingly).


$JAVA_HOME must be set. At least JDK 1.4 is necessary.

Known Issues:

chown needs to be invoked without group parameter if your tomcat user has no group. Users with login shell /dev/null is a good idea but need special attention.

Go to Sourceforge download page Logo

Mail to author
Disclaimer: Usage of software provided here is without warranty. If you don't know what to do with this stuff, please read documentation or turn off your internet. Thanks.
You still haven't left, have you? In case you dislike what you saw here, you might want to ask Men In Black for doing that flashy things to make you forget. Keep in mind that I am not responsible for anything that happens, or did I tell you to come to this site? I am not responsible for contents on linked sites, too.