Running Two Instances of Tomcat

  • Post author:
  • Post category:Java

If you have a need to run multiple instances of Tomcat, using the same Tomcat binaries, read the RUNNING.txt that can be found in the root Tomcat directory. If you need to run multiple instances of Tomcat, with the ability to use different Tomcat versions as needed, you will need to install 2 Tomcats and modify the ports in the second Tomcat install.

In the second Tomcat install, edit TOMCAT_HOME/conf/server.xml and look for ports that you need to change.

1. Change the shutdown port. Change 8005 to something like 8105.

<Server port="8105" shutdown="SHUTDOWN">

2. Change the connector ports. Change 8080 to something like 8180. You might also need to change the redirect port if you use SSL on Tomcat. Change 8443 to something like 8143.

<Connector port="8180" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8143" />

3. If you use the AJP Connector, also change the AJP port. Change 8009 to something like 8109.

<Connector port="8109" protocol="AJP/1.3" redirectPort="8143" />

4. If you are running under Linux, it might be a good idea to run the second Tomcat instance as a different user, so you can easily tell who’s running and to lessen the possibility of incorrectly restarting the wrong instance.