Tomcat – Multiple Tomcat Instance that runs as a windows service

tomcatwindows-service

Could I execute multiple instances of Tomcat server as windows services from same physical location (CATALINA_HOME)? In other words, could I execute Tomcat windows service referred to specific server.xml (not a default location)?
I know that this option is available for Tomcat execution from bat file.

Best Answer

Yes, you can do this.

If you are using Windows you can use the official documentation: http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

I would recommend downloading the service.bat file associated with your windows distribution. This answer covers how to do that: https://stackoverflow.com/questions/15798813/tomcat-7-service-bat-file-is-missing

If you do not have the service.bat file, you will need to use the command line arguments for Tomcat7.exe in your bin folder. Check "Installing services" and "Updating Services" for example on how to run the executable through the command line and configure your service the way you'd like.

Most importantly, you need an instance folder (which you will set your using your CATALINA_HOME variable). Inside that, you should have a conf folder with a web.xml and a server.xml). Like Peter suggested, change the four ports specified in connectors (8080, 8005, 8009, and 8443) to something else so they do not conflict with your first installation.