Can I run two tomcat instances on the same machine?

Solution 1:

Apart from changing Connector port for protocol="HTTP/1.1" described in one of the answers below.

I think it requires to change Server port for 'Shutdown'

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

and also AJP port no.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

If you want to run multiple tomcat instances in parallel.

Solution 2:

Yes !. You can. You need to change your port to have another instance.

To do so follow the steps.

1.) Locate server.xml in {Tomcat installation folder}\ conf \

2.)Find following similar statement

<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 -->
    <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

3.) About Tomcat’s server.xml file cites it’s runs on port 8080. Change the Connector port=”8080″ port to any other port number.

For example

<Connector port="8181" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />

4) Edit and save the server.xml file. Restart Tomcat. Done

Solution 3:

Yes, that's absolutely fine. I've done it on numerous occasions. You'll need to check all the ports you're using for Tomcat though. I can't remember whether it still has a special "local control" port, but if so those will need to be different too.

Solution 4:

In general we also set CATALINA_HOME property. so startup script first reads catalina_home and than from it figures out rest of the path. If this environment variable is set and if you try to run tomcat from any copy-paste tomcat installation location, you will get tomcat running which is pointed by CATALINA_HOME.

So while running two tomcat from same machine, remove the CATALINA_HOME property. That way it will set the CATALINA_HOME property based on directory from which you are running the startup script.

Solution 5:

Adding a few pointers to detailed instructions on how to accomplish that:

  1. Step by step Running Multiple Tomcat Instances on One Server.
  2. An older version of the above.
  3. Explanation of various environment variables & folders that play a role in such setup.