Running two independent tomcats on one machine, instead of one tomcat with multiple instances
Solution 1:
Yes, we do this frequently.
Basically our approach (on Windows) is:
- Ensure the full JDK is installed (Tomcat batch files require this)
- Download and Tomcat (6.1.20) - the zip version, not the windows installer.
- Unzip to a folder named for the purpose of the Tomcat instance (eg to C:\Tomcat6_SW for SuperWEB 1)
- Copy the unzipped files to other folders for the other required instances (eg C:\Tomcat6_SW2, C:\Tomcat6_SV)
- For each instance, edit server.xml so that there are no port conflicts
- For each instance:
- a. Edit startup.bat to explicitly define CATALINA_HOME and JAVA_HOME
- b. Rename startup.bat to reflect the purpose of the Tomcat instance, for instance SWstartup.bat for SuperWEB1
- c. Edit service.bat as above to explicitly define CATALINA_HOME and JAVA_HOME
- d. Run service.bat to create a Windows service with a service name and description for this Tomcat instance. The service name must be unique, and cannot contain spaces.
- e. Rename the tomcat6w.exe file to the name of the service that you have created (for instance, if the service name is SWEB1Tomcat, tomcat6w.exe should be renamed to SWEB1Tomcat.exe). If this is not done, the tomcat6w.exe application will not refer to the correct service.
- f. Run the renamed application and set service properties as follows:
- set any Java options required in the Java tab
- set the startup type to Automatic
- IMPORTANT: change the Log On account to other than “Local System account”, ie something with a lower privilege level.
(Note that you may want to create separate setenv.bat files for each instance.