Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Hi How can I start two Tomcat instances in a single LINUX machine. Both the tomcat must run on the different ports. If this is possible then How can I do this

Thanks.

share|improve this question

migrated from stackoverflow.com Jun 25 '10 at 1:06

This question came from our site for professional and enthusiast programmers.

3 Answers 3

It's very possible, just create two copies of the installation and make sure to edit the TOMCAT_HOME/conf/server.xml in one instance and change the ports so they don't clash. Start each instance with their own TOMCAT_HOME/bin/startup.sh script.

The one port you will have to change in one of your Tomcats is the one defined in the port attribute of your <Connector> (8080 here):

<Connector port="8080"
           protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
share|improve this answer

Edit the tomcat configuration file (usually server.xml in tomcat\conf) and change the value after the line:

port="8080"

to another port (example 8081).

Read Multiple Tomcat JVM on Jajakarta for more information.

share|improve this answer

You need to start tomcat with different catalina bases. This can be controlled for instance by the CATALINA_BASE environment variable. That variable has to point to a location containing conf, logs, temp, webapps and work subdirectories. Then you can put into the corresponding conf and webapps directories the configurations and webapps you want for the individual instances.

So something along those lines will give you two instances:

SET CATALINA_BASE=/home/tomcat_inst1/
tomcat start
SET CATALINA_BASE=/home/tomcat_inst2/
tomcat start

Of course, as other people wrote, you have to ensure that the listening ports for any connectors are different in each instance.

Also see here: http://www.jguru.com/faq/view.jsp?EID=1121565

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.