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

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.

share|improve this question

migrated from stackoverflow.com Jan 3 '12 at 12:52

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

    
Maybe you can just try it? –  home Jan 3 '12 at 12:18
    
I did not succeed to do it. How I can point a Tomcat server to specific server.xml file? –  user1126486 Jan 3 '12 at 13:27
    
Yes but each has to use a different listenning port but that is possible for sure –  Kiwy Jan 8 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 –  Peter Turner Jan 8 at 15:37

3 Answers 3

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: http://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.

share|improve this answer
    
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. –  Peter Turner Jan 14 at 15:32

well if I have the answer let put an answer. If you want to run several instance you need to use different port on every different config.

Good luck for changing them.

share|improve this answer

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 http://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.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.