Monday, January 30, 2012

Running Multiple Instances of Tomcat [JBoss EWS].

We sometimes need to test some features of tomcat by running multiple instances of it. Tomcat needs CATALINA_HOME and CATALINA_BASE environment variable for better running, but if we run multiple instance after setting these environment variables, multiple tomcats may not run properly. This article explains on how to run multiple instances of tomcat on a single machine,

Download the Tomcat to a location

Export the CATALINA_HOME and CATALINA_BASE.Add these to the /root/.bashrc

export CATALINA_HOME=/usr/jboss-ews-1.0/tomcat6;
export CATALINA_BASE=/usr/jboss-ews-1.0/tomcat6;

Once added, use source command to update, source /root/.bashrc

Now create 2 directories in other location (I have create tmc1 and tmc2 in /usr/local)

Once both locations are created, copy the directories bin, conf, lib, logs, temp, webapps, and work.

In bin directory, remove all the files except, and (if windows keep their respective bat files)

Clean and and update with the following

export CATALINA_BASE=/usr/local/tmc2
export CATALINA_HOME=/usr/jboss-ews-1.0/tomcat6


export CATALINA_BASE=/usr/local/tmc2
export CATALINA_HOME=/usr/jboss-ews-1.0/tomcat6

Once these changes are done, go to the conf location and modify the server.xml file according to your port needs. The 2 main ports to change in server.xml are shutdown port and http port. It would be good if we change all ports.

Now you start the tomcat instances using file bin location
More articles to come. Happy Coding…
Read More