Reading Time: 6 minutes
Organizations running Apache Tomcat in production on Windows often want to run Tomcat as a Windows service. This removes the need for someone to be actively logged into the server and provides an easy way to integrate with Windows management tools. In this blog, I will explain the easiest way to run Tomcat as a Windows service and how you can do this for multiple instances as well.
Running an instance of Apache Tomcat as a Windows service is not complicated, if you download the correct distribution of Tomcat (Windows service Installer). However, running multiple instances of Tomcat as Windows services is a more complicated process. To avoid issues, you would have to:
1. Uninstall the service that the installer has installed ( if you used the service installer)
2. Run the service.bat command and give it an unique name ( so, next service install would not fail )
service.bat install MyTomcat2 ( you have to download the zip distribution to get service.bat )
2. For each instance, edit server.xml and manually modify all ports to unique non-default numbers
3. Go to Service Control Manager by running ‘services’ from Start menu and change the startup type for each instance to be “Automatic”
You would have to repeat this process for each instance that you want to install, which can get tedious and potentially quite error-prone.
The Tcat Server installer provides a much better experience by enabling you to select a name for the service and also by enabling you to install multiple Tomcat instances on the same box. All you have to do is to run a standard install of Tcat Server on Windows, and it will automatically install Apache Tomcat as a Windows service. It can detect name conflicts and pick unique service names for the Windows services. (The installer also detects port conflicts, so you don’t run into start-up issues due to port conflicts).
Continue reading →