0

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.

4
  • Maybe you can just try it?
    – home
    Jan 3, 2012 at 12:18
  • I did not succeed to do it. How I can point a Tomcat server to specific server.xml file? Jan 3, 2012 at 13:27
  • Yes but each has to use a different listenning port but that is possible for sure
    – Kiwy
    Jan 8, 2014 at 14:39
  • @Kiwy I guess that's the answer, I just didn't realize how many ports you'd need to change. There are like 4 ports that tomcat uses for each server.xml Jan 8, 2014 at 15:37

3 Answers 3

2
+50

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.

1
  • We installed tomcat from the .exe and one thing I noticed is that there's a service install log file with 4 commands in it, that was totally awesomely useful for making it work in multiple instances, just copy the four lines fiddle around with the paths and install all the instances your server can handle. Jan 14, 2014 at 15:32
0

The best way to do this is with CATALINA_BASE variable, you don't want to mess around and copy binaries for each instance. Just install the base installation, then create a servers folder with your unique instances which will just contain the conf/lib/bin/logs/temp folders for each instance you need.

Each instance needs it's own port, so if using shutdown/http/ajp/JMX ports, remember to offset these.

Review https://stackoverflow.com/questions/3090398/tomcat-catalina-base-and-catalina-home-variables

You can look up vFabric tc server documentation which has good examples on this.

0

If you want to run several instance you need to use different port on every different config.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .