Saturday, February 25, 2012

Running Multiple Instances of Tomcat on Windows Machine

To run multiple instances of tomcat the two most important things that you need are CATALINA_HOME and CATALINA_BASE variables set properly.

CATALINA_HOME refers to the base tomcat directory which has all the files required for starting and stopping tomcat. It mainly includes two folders bin and lib.

CATALINA_HOME  would be common for all the tomcat instances running on that machine.

CATALINA_BASE would be different for different instances and each instance would refer to its particular CATALINA_BASE directory. This usually includes the following folders inside it, conf, webapps, temp, work & log.

Inside the conf folder, edit the server.xml file to listen to different ports for different instances.

How to have multiple CATALINA_BASE variables ?

Download and copy the tomcat folder to some directory of your choice. I have installed it like this F:\Servers\apache-tomcat-7.0.26

Now create another folder and inside that create a folder name bin. Inside bin create two files namely startup.bat and shutdown.bat

I created a folder name Elephant (which is one of the name of my tomcat instance) under F:\Servers\

Now in the startup.bat put the following lines and edit the path as appropriate.


set CATALINA_BASE=F:\Servers\Elephant
set CATALINA_HOME=F:\Servers\apache-tomcat-7.0.26
F:\Servers\apache-tomcat-7.0.26\bin\startup.bat

In shutdown.bat put the following:


set CATALINA_BASE=F:\Servers\Elephant
set CATALINA_HOME=F:\Servers\apache-tomcat-7.0.26
F:\Servers\apache-tomcat-7.0.26\bin\shutdown.bat




No comments:

Post a Comment