blob: 2fb0f6306921642b080e6a134cb07691c45b75ab [file] [log] [blame]
Cheng Tang07b30872014-04-27 16:37:18 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.42) - Windows service HOW-TO</title><meta name="author" content="Mladen Turk"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4 </style><style type="text/css">
5 code {background-color:rgb(224,255,255);padding:0 0.1em;}
6 code.attributeName, code.propertyName {background-color:transparent;}
7 </style><style type="text/css">
8 .wrapped-source code { display: block; background-color: transparent; }
9 .wrapped-source div { margin: 0 0 0 1.25em; }
10 .wrapped-source p { margin: 0 0 0 1.25em; text-indent: -1.25em; }
11 </style><style type="text/css">
12 p.notice {
13 border: 1px solid rgb(255, 0, 0);
14 background-color: rgb(238, 238, 238);
15 color: rgb(0, 51, 102);
16 padding: 0.5em;
17 margin: 1em 2em 1em 1em;
18 }
19 </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="./images/tomcat.gif" align="right" alt="
20 The Apache Tomcat Servlet/JSP Container
21 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.42, Jul 2 2013</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>User Guide</strong></p><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="realm-howto.html">6) Realms and AAA</a></li><li><a href="security-manager-howto.html">7) Security Manager</a></li><li><a href="jndi-resources-howto.html">8) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">9) JDBC DataSources</a></li><li><a href="class-loader-howto.html">10) Classloading</a></li><li><a href="jasper-howto.html">11) JSPs</a></li><li><a href="ssl-howto.html">12) SSL</a></li><li><a href="ssi-howto.html">13) SSI</a></li><li><a href="cgi-howto.html">14) CGI</a></li><li><a href="proxy-howto.html">15) Proxy Support</a></li><li><a href="mbeans-descriptor-howto.html">16) MBean Descriptor</a></li><li><a href="default-servlet.html">17) Default Servlet</a></li><li><a href="cluster-howto.html">18) Clustering</a></li><li><a href="balancer-howto.html">19) Load Balancer</a></li><li><a href="connectors.html">20) Connectors</a></li><li><a href="monitoring.html">21) Monitoring and Management</a></li><li><a href="logging.html">22) Logging</a></li><li><a href="apr.html">23) APR/Native</a></li><li><a href="virtual-hosting-howto.html">24) Virtual Hosting</a></li><li><a href="aio.html">25) Advanced IO</a></li><li><a href="extras.html">26) Additional Components</a></li><li><a href="maven-jars.html">27) Mavenized</a></li><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</a></li></ul><p><strong>Reference</strong></p><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.2 Javadocs</a></li><li><a href="elapi/index.html">EL 2.2 Javadocs</a></li><li><a href="http://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul><p><strong>Apache Tomcat Development</strong></p><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="http://wiki.apache.org/tomcat/TomcatVersions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="funcspecs/index.html">Functional Specs.</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Windows service HOW-TO</h1><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
22<ul><li><a href="#Tomcat7_service_application">Tomcat7 service application</a></li><li><a href="#Tomcat7w_monitor_application">Tomcat7w monitor application</a></li><li><a href="#Command_line_arguments">Command line arguments</a></li><li><a href="#Command_line_parameters">Command line parameters</a></li><li><a href="#Installing_services">Installing services</a></li><li><a href="#Updating_services">Updating services</a></li><li><a href="#Removing_services">Removing services</a></li><li><a href="#Debugging_services">Debugging services</a></li><li><a href="#Multiple_Instances">Multiple Instances</a></li></ul>
23</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Tomcat7 service application"><!--()--></a><a name="Tomcat7_service_application"><strong>Tomcat7 service application</strong></a></font></td></tr><tr><td><blockquote>
24<p>
25 <b>Tomcat7</b> is a service application for running Tomcat7 as NT service.
26</p>
27</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Tomcat7w monitor application"><!--()--></a><a name="Tomcat7w_monitor_application"><strong>Tomcat7w monitor application</strong></a></font></td></tr><tr><td><blockquote>
28<p>
29 <b>Tomcat7w</b> is a GUI application for monitoring and configuring Tomcat
30 services.
31</p>
32 <p>The available command line options are:</p>
33<p>
34 <table>
35 <tr><th>//ES//</th>
36 <td>Edit service configuration</td>
37 <td>This is the default operation. It is called if the no option is
38 provided but the executable is renamed to <b>servicenameW.exe</b></td>
39 </tr>
40 <tr><th>//MS//</th>
41 <td>Monitor service</td>
42 <td>Put the icon in the system tray</td>
43 </tr>
44 </table>
45</p>
46</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Command line arguments"><!--()--></a><a name="Command_line_arguments"><strong>Command line arguments</strong></a></font></td></tr><tr><td><blockquote>
47<p>
48 Each command line directive is in the form of <b>//XX//ServiceName</b>
49</p>
50 <p>The available command line options are:</p>
51<p>
52 <table>
53 <tr><th>//TS//</th>
54 <td>Run the service as console application</td>
55 <td>This is the default operation. It is called if the no option is
56 provided. The ServiceName is the name of the executable without
57 exe suffix, meaning Tomcat7</td>
58 </tr>
59 <tr><th>//RS//</th>
60 <td>Run the service</td>
61 <td>Called only from ServiceManager</td>
62 </tr>
63 <tr><th>//SS//</th>
64 <td>Stop the service</td>
65 <td></td>
66 </tr>
67 <tr><th>//US//</th>
68 <td>Update service parameters</td>
69 <td></td>
70 </tr>
71 <tr><th>//IS//</th>
72 <td>Install service</td>
73 <td></td>
74 </tr>
75 <tr><th>//DS//</th>
76 <td>Delete service</td>
77 <td>Stops the service if running</td>
78 </tr>
79 </table>
80</p>
81</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Command line parameters"><!--()--></a><a name="Command_line_parameters"><strong>Command line parameters</strong></a></font></td></tr><tr><td><blockquote>
82<p>
83 Each command parameter is prefixed with <b>--</b>.
84 If the command line is prefixed with <b>++</b> then it's value will
85 be appended to the existing option.
86 If the environment variable with the same name as command line parameter but
87 prefixed with <code>PR_</code> exists it will take precedence.
88 For example:
89<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>set PR_CLASSPATH=xx.jar</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
90</p>
91<p>is equivalent to providing
92<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>--Classpath=xx.jar</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
93</p>
94<p> as command line parameter.</p>
95<p>
96 <table>
97 <tr>
98 <th>ParameterName</th>
99 <th>Default</th>
100 <th>Description</th>
101 </tr>
102 <tr>
103 <td>--Description</td>
104 <td></td>
105 <td>Service name description (maximum 1024 characters)</td>
106 </tr>
107 <tr>
108 <td>--DisplayName</td>
109 <td>ServiceName</td>
110 <td>Service display name</td>
111 </tr>
112 <tr>
113 <td>--Install</td>
114 <td>procrun.exe //RS//ServiceName</td>
115 <td>Install image</td>
116 </tr>
117 <tr>
118 <td>--Startup</td>
119 <td>manual</td>
120 <td>Service startup mode can be either <b>auto</b> or <b>manual</b></td>
121 </tr>
122 <tr>
123 <td>--DependsOn</td>
124 <td></td>
125 <td>List of services that this service depend on. Dependent services
126 are separated using either <b>#</b> or <b>;</b> characters</td>
127 </tr>
128 <tr>
129 <td>--Environment</td>
130 <td></td>
131 <td>List of environment variables that will be provided to the service
132 in the form <b>key=value</b>. They are separated using either
133 <b>#</b> or <b>;</b> characters. If you need to use either the <b>#</b>
134 or <b>;</b> character within a value then the entire value must be
135 enclosed inside single quotes.</td>
136 </tr>
137 <tr>
138 <td>--User</td>
139 <td></td>
140 <td>User account used for running executable. It is used only for
141 StartMode <b>java</b> or <b>exe</b> and enables running applications
142 as service under account without LogonAsService privilege.</td>
143 </tr>
144 <tr>
145 <td>--Password</td>
146 <td></td>
147 <td>Password for user account set by --User parameter</td>
148 </tr>
149 <tr>
150 <td>--JavaHome</td>
151 <td>JAVA_HOME</td>
152 <td>Set a different JAVA_HOME than defined by JAVA_HOME environment
153 variable</td>
154 </tr>
155 <tr>
156 <td>--Jvm</td>
157 <td>auto</td>
158 <td>Use either <b>auto</b> or specify the full path to the <b>jvm.dll</b>.
159 You can use the environment variable expansion here.</td>
160 </tr>
161 <tr>
162 <td>--JvmOptions</td>
163 <td>-Xrs</td>
164 <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be
165 passed to the JVM. The options are separated using either
166 <b>#</b> or <b>;</b> characters.</td>
167 </tr>
168 <tr>
169 <td>--Classpath</td>
170 <td></td>
171 <td>Set the Java classpath</td>
172 </tr>
173 <tr>
174 <td>--JvmMs</td>
175 <td></td>
176 <td>Initial memory pool size in MB</td>
177 </tr>
178 <tr>
179 <td>--JvmMx</td>
180 <td></td>
181 <td>Maximum memory pool size in MB</td>
182 </tr>
183 <tr>
184 <td>--JvmSs</td>
185 <td></td>
186 <td>Thread stack size in KB</td>
187 </tr>
188 <tr>
189 <tr>
190 <td>--StartImage</td>
191 <td></td>
192 <td>Executable that will be run.</td>
193 </tr>
194 <tr>
195 <td>--StartPath</td>
196 <td></td>
197 <td>Working path for the start image executable.</td>
198 </tr>
199 <tr>
200 <td>--StartClass</td>
201 <td></td>
202 <td>Class that will be used for startup.</td>
203 </tr>
204 <tr>
205 <td>--StartParams</td>
206 <td></td>
207 <td>List of parameters that will be passed to either StartImage or
208 StartClass. Parameters are separated using either <b>#</b> or
209 <b>;</b> character.</td>
210 </tr>
211 <tr>
212 <td>--StartMethod</td>
213 <td>Main</td>
214 <td>Method name if differs then main</td>
215 </tr>
216 <tr>
217 <td>--StartMode</td>
218 <td>executable</td>
219 <td>Can one of <b>jvm</b> <b>java</b> or <b>exe</b></td>
220 </tr>
221 <td>--StopImage</td>
222 <td></td>
223 <td>Executable that will be run on Stop service signal.</td>
224 </tr>
225 <tr>
226 <td>--StopPath</td>
227 <td></td>
228 <td>Working path for the stop image executable.</td>
229 </tr>
230 <tr>
231 <td>--StopClass</td>
232 <td></td>
233 <td>Class that will be used on Stop service signal.</td>
234 </tr>
235 <tr>
236 <td>--StopParams</td>
237 <td></td>
238 <td>List of parameters that will be passed to either StopImage or
239 StopClass. Parameters are separated using either <b>#</b> or
240 <b>;</b> character.</td>
241 </tr>
242 <tr>
243 <td>--StopMethod</td>
244 <td>Main</td>
245 <td>Method name if differs then main</td>
246 </tr>
247 <tr>
248 <td>--StopMode</td>
249 <td>executable</td>
250 <td>Can one of <b>jvm</b> <b>java</b> or <b>exe</b></td>
251 </tr>
252 <tr>
253 <td>--StopTimeout</td>
254 <td>No Timeout</td>
255 <td>Defines the timeout in seconds that procrun waits for service to
256 exit gracefully.</td>
257 </tr>
258 <tr>
259 <td>--LogPath</td>
260 <td>working path</td>
261 <td>Defines the path for logging</td>
262 </tr>
263 <tr>
264 <td>--LogPrefix</td>
265 <td>jakarta_service</td>
266 <td>Defines the service log filename</td>
267 </tr>
268 <tr>
269 <td>--LogLevel</td>
270 <td>INFO</td>
271 <td>Defines the logging level and can be either <b>error</b>,
272 <b>info</b>, <b>warn</b> or <b>debug</b></td>
273 </tr>
274 <tr>
275 <td>--StdOutput</td>
276 <td></td>
277 <td>Redirected stdout filename</td>
278 </tr>
279 <tr>
280 <td>--StdError</td>
281 <td></td>
282 <td>Redirected stderr filename</td>
283 </tr>
284 </table>
285</p>
286</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Installing services"><!--()--></a><a name="Installing_services"><strong>Installing services</strong></a></font></td></tr><tr><td><blockquote>
287<p>
288The safest way to manually install the service is to use the provided
289<b>service.bat</b> script. Administrator privileges are required to run this
290script. If necessary, you can use the <code>/user</code> switch to specify
291a user to use for the installation of the service.
292</p>
293<p>
294<strong>NOTE:</strong> On Windows Vista or any other operating system with User
295Account Control (UAC) you must either disable UAC or right-click on cmd.exe and
296select "Run as administrator" in order to run this script. If UAC is enabled
297neither being logged on with an Administrator account, nor using the
298<code>/user</code> switch is sufficient.
299</p>
300<p>
301<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
302Install the service named 'Tomcat7'
303C:\&gt; service.bat install
304</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
305</p>
306<p>There is a 2nd optional parameter that lets you specify the name of the
307service, as displayed in Windows services.</p>
308<p>
309<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
310Install the service named 'MyService'
311C:\&gt; service.bat install MyService
312</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
313</p>
314<p>
315If using tomcat7.exe, you need to use the <b>//IS//</b> parameter.</p>
316<p>
317<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
318Install the service named 'Tomcat7'
319C:\&gt; tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" \
320C:\&gt; --Install="C:\Program Files\Tomcat\bin\tomcat7.exe" --Jvm=auto \
321C:\&gt; --StartMode=jvm --StopMode=jvm \
322C:\&gt; --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start \
323C:\&gt; --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
324</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
325</p>
326</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Updating services"><!--()--></a><a name="Updating_services"><strong>Updating services</strong></a></font></td></tr><tr><td><blockquote>
327<p>
328To update the service parameters, you need to use the <b>//US//</b> parameter.
329</p>
330<p>
331<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
332Update the service named 'Tomcat7'
333C:\&gt; tomcat7 //US//Tomcat7 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \
334C:\&gt; --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar
335</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
336</p>
337<p>If you gave the service an optional name, you need to specify it like this:
338</p>
339<p>
340<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
341Update the service named 'MyService'
342C:\&gt; tomcat7 //US//MyService --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \
343C:\&gt; --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar
344</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
345</p>
346</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Removing services"><!--()--></a><a name="Removing_services"><strong>Removing services</strong></a></font></td></tr><tr><td><blockquote>
347<p>
348To remove the service, you need to use the <b>//DS//</b> parameter.<br>
349If the service is running it will be stopped and then deleted.</p>
350<p>
351<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
352Remove the service named 'Tomcat7'
353C:\&gt; tomcat7 //DS//Tomcat7
354</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
355</p>
356<p>If you gave the service an optional name, you need to specify it like this:
357</p>
358<p>
359<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
360Remove the service named 'MyService'
361C:\&gt; tomcat7 //DS//MyService
362</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
363</p>
364</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Debugging services"><!--()--></a><a name="Debugging_services"><strong>Debugging services</strong></a></font></td></tr><tr><td><blockquote>
365<p>
366To run the service in console mode, you need to use the <b>//TS//</b> parameter.
367The service shutdown can be initiated by pressing <b>CTRL+C</b> or
368<b>CTRL+BREAK</b>.
369If you rename the tomcat7.exe to testservice.exe then you can just execute the
370testservice.exe and this command mode will be executed by default.</p>
371<p>
372<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
373Run the service named 'Tomcat7' in console mode
374C:\&gt; tomcat7 //TS//Tomcat7 [additional arguments]
375Or simply execute:
376C:\&gt; tomcat7
377</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
378</p>
379</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Multiple Instances"><!--()--></a><a name="Multiple_Instances"><strong>Multiple Instances</strong></a></font></td></tr><tr><td><blockquote>
380<p>
381Tomcat supports installation of multiple instances. You can have a single
382installation of Tomcat with multiple instances running on different IP/port
383combinations, or multiple Tomcat versions, each running one or more instances on
384different IP/ports.</p>
385<p>
386Each instance folder will need the following structure:
387</p>
388<ul>
389<li>conf</li>
390<li>logs</li>
391<li>temp</li>
392<li>webapps</li>
393<li>work</li>
394</ul>
395<p>
396At a minimum, conf should contain a copy of the following files from
397CATALINA_HOME\conf\. Any files not copied and edited, will be picked up by
398default from CATALINA_HOME\conf, i.e. CATALINA_BASE\conf files override defaults
399from CATALINA_HOME\conf.</p>
400<ul>
401<li>server.xml</li>
402<li>web.xml</li>
403</ul>
404<p>
405You must edit CATALINA_BASE\conf\server.xml to specify a unique IP/port for the
406instance to listen on. Find the line that contains
407<pre>&lt;Connector port="8080" ...</pre> and add an address attribute and/or
408update the port number so as to specify a unique IP/port combination.</p>
409<p>
410To install an instance, first set the CATALINA_HOME environment variable to the
411name of the Tomcat installation directory. Then create a second environment
412variable CATALINA_BASE and point this to the instance folder. Then run "service
413install" command specifying a service name.</p>
414<p>
415<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
416set CATALINA_HOME=c:\tomcat_7
417set CATALINA_BASE=c:\tomcat_7\instances\instance1
418service install instance1
419</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
420</p>
421<p>
422To modify the service settings, you can run <b>tomcat7w //ES//instance1</b>.
423</p>
424<p>
425For additional instances, create additional instance folder, update the
426CATALINA_BASE environment variable, and run the service install again.</p>
427<p>
428<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
429set CATALINA_BASE=c:\tomcat_7\instances\instance2
430service install instance2
431</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
432</p>
433</blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
434 on improving documentation for Apache Tomcat.<br><br>
435 If you have trouble and need help, read
436 <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
437 and ask your question on the tomcat-users
438 <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
439 Do not ask such questions here. This is not a Q&amp;A section.<br><br>
440 The Apache Comments System is explained <a href="/tomcat-7.0-doc/comments.html">here</a>.
441 Comments may be removed by our moderators if they are either
442 implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
443 var comments_shortname = 'tomcat';
444 var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html';
445 (function(w, d) {
446 if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
447 d.write('<div id="comments_thread"><\/div>');
448 var s = d.createElement('script');
449 s.type = 'text/javascript';
450 s.async = true;
451 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
452 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
453 }
454 else {
455 d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
456 }
457 })(window, document);
458 //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
459 Copyright &copy; 1999-2013, Apache Software Foundation
460 </em></font></div></td></tr></table></body></html>