Running multiple Tomcat instances on Windows

The steps for running multiple Tomcat instances on Windows described below would not work for Tomcat installed as Windows Service Installer

  • Download and install Apache Tomcat to an appropriate directory with no spaces and directory name, for example C:\Apache\Tomcat1
  • For each instance of Tomcat you're going to run, you'll need a directory that will be CATALINA_HOME, so create C:\Apache\Tomcat2 directory
  • Copy the conf directory to C:\Apache\Tomcat2 directory
  • Under C:\Apache\Tomcat2, create a bin, logs, temp, webapps and work directories
  • Modify shutdown port and HTTP connector port in C:\Apache\Tomcat2\conf\server.xml
  • In the C:\Apache\Tomcat2 directory, create a file called startup.bat with these two lines:

set CATALINA_BASE=C:\Apache\Tomcat2

  • In the C:\Apache\Tomcat2 directory, create a file called shutdown.bat with these two lines:

set CATALINA_BASE=C:\Apache\Tomcat2

Repeat the installation for as many tomcat instances as you want.


Stells said...

Thank you very much! Your explanation is clear and brief! :)

Cintia said...

Is it possible to run the instances as services?

Anonymous said...

Just run service.bat to make it a server.

service install servicename

dont use special characters such as - or _

Anonymous said...

Hi there

I'm trying to install the second instance as a service but I'm obviously doing something wrong. I've copied the service.bat file to the second instance's bin directory. Then I set CATALINA_HOME and CATALINA_BASE and run the service.bat. But I just get an error saying "Files was unexpected at this time".

What to do?


Anonymous said...

The process you described should have worked. I suspect you have some environment variable that the Tomcat scripts are using that is set to an unusual value; in particular it may need quotes around the value if it contains embedded spaces. Do a "set" command to see what is set at the point when you're about to run the script; post the results if nothing obvious pops out.

Anonymous said...

Hi there

I know managed to install the service. My problem was that I had used quotes in the CATALINA_HOME and BASE parameters.

Now I have a new problem. I can run both Tomcat instances now with no errors in the log files, but only the first one answers.

If I instead shut down instance number one and run instance number two with the same config file as number one it still doesn't answer.

Any ideas how to continue from here?


mamma mia said...

Thank you very much! found this after several hours of research.

Anonymous said...

Thanks a lot! Very short and helpful