Pivotal Knowledge Base


VMware: Running Apache Tomcat as a Windows service



This article provides information on running Apache Tomcat as a Windows service.


To install a Tomcat instance as a Windows service:
Note: These steps have the Tomcat 6.0.35 instance installed on:
  1. Open a DOS prompt and change directory to C:\opt\instances\tc6035-example1\bin folder.
  2. Setup CATALINA_HOME and CATALINA_BASE environment variables:

    > set CATALINA_HOME=C:\opt\apache-tomcat-6.0.35
    > set CATALINA_BASE=C:\opt\instances\tc6035-example1
  3. Install the Tomcat NT service and choose a unique service name. For example, where <tc6035> indicates the name:

    > service.bat install tc6035-example1
  4. Setup the tc6035-example1\bin\tomcat6w.exe GUI program to monitor and manage our Tomcat instance. Make a copy of tomcat6w.exe and give the file a new name to match the Tomcat Windows service name. 

    Note: Part of the file name tc6035-example1 without "w.exe" is the NT service name. The service name must match the Tomcat Windows service name that you installed in step 3.

  5. Use the tc6035-example1w.exe GUI or tomcat6.exe command line to update the instance of  Tomcat Windows service:

    For example, you can use the tomcat6.exe command line altering existing JVM memory initial and max pool sizes (--JvmMs,--JvmMx) to add new JMX options for remote monitoring and management:

    > tomcat6.exe //US//tc6035-example1 --JvmMs=256 --JvmMx=512  ++JvmOptions "-Dcom.sun.management.jmxremote;-Dcom.sun.management.jmxremote.port=8991;-Dcom.sun.management.jmxremote.ssl=false;-Dcom.sun.management.jmxremote.authenticate=false;-Djava.rmi.server.hostname=localhost"
Note: For a remote JMX, you must ensure that the .jmxremote.port is unique per server instances. Consider using authentication access and/or SSL for security. For more information, see http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html.

For a complete list of  tomcat6.exe command line usage arguments and parameters, see http://commons.apache.org/daemon/procrun.html.

Alternatively, you can launch the tc6035-example1w.exe GUI program  (created in step 4) to alter and add new Java options to Tomcat Windows service. You can also launch the original tomcat6w.exe GUI along with the ES and Tomcat Windows service name parameters to manage Tomcat instance. For example: 
> tomcat6w.exe //ES//tc6035-example1 (same as running tc6035-example1w.exe)

If you experience difficulty starting up Tomcat NT service, check the Java Virtual Machine path and options in tc6035-example1w.exe GUI to ensure they are set correctly.

Additional Information

For related information, see:
©VMware 2013


Powered by Zendesk