TomcatExpert

Configuring tcServer as Windows service with optional parameters

posted by SpringSource on December 17, 2009 06:41 PM

With the Apache Tomcat, there is a default service.bat script in the bin\ folder which allows configuration customization.  For example,  you can configure JVM settings and environment variables that are needed to run Tomcat as a service.  

For tcServer there are couple of ways to add additional variables and/or JVM options when running tc Server as a windows service.  The most common approach is to modify the Tomcat service wrapper. 

 However before modifying the wrapper, you need to understand how to install tcServer as a windows service. To install tcServer as a Windows service:

• Create the tcServer instance with the “tcserver-instance” script
• Then install the windows service for that new instance by changing into the bin\ folder and running the “tcserver-ctl.bat” with the flag “install”

Now that you understand how to create service to modify the behaviour of the wrapper you must edit the \conf\wrapper.conf file.  This file can be edited to tweak the behavior of the window service as well as changing JAVA_HOME, JVM parameters and any other desired environment variables.  For example:

set.some_variable=some_value

NOTE: These variables will only be set if tcServer Tomcat is started as a Windows Service.
 

The other option to configure additional variables is through the setenv.bat script.  This script resides in the instance's bin\ folder.  In modifying this file, JAVA_OPTS  (used during START/STOP/RUN) and CATALINA_OPTS (used during START/RUN) can be added or modified.  When tcServer is started, this file will be invoked, allowing the user to set these variables at runtime. This file invoked whether tcServer is started as a Windows service or not.  This is an alternative method when Tomcat is not run as a Window service.
 

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.

Comments

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.