Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
771 blopes 1
<!DOCTYPE html SYSTEM "about:legacy-compat">
2
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="./images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 (9.0.112) - Windows Service How-To</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="./images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="./images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9</h1><div class="versionInfo">
3
            Version 9.0.112,
4
            <time datetime="2025-11-06">Nov 6 2025</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="index.html">Docs Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li></ul></div><div><h2>User Guide</h2><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="host-manager-howto.html">6) Host Manager</a></li><li><a href="realm-howto.html">7) Realms and AAA</a></li><li><a href="security-manager-howto.html">8) Security Manager</a></li><li><a href="jndi-resources-howto.html">9) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">10) JDBC DataSources</a></li><li><a href="class-loader-howto.html">11) Classloading</a></li><li><a href="jasper-howto.html">12) JSPs</a></li><li><a href="ssl-howto.html">13) SSL/TLS</a></li><li><a href="ssi-howto.html">14) SSI</a></li><li><a href="cgi-howto.html">15) CGI</a></li><li><a href="proxy-howto.html">16) Proxy Support</a></li><li><a href="mbeans-descriptors-howto.html">17) MBeans Descriptors</a></li><li><a href="default-servlet.html">18) Default Servlet</a></li><li><a href="cluster-howto.html">19) Clustering</a></li><li><a href="balancer-howto.html">20) Load Balancer</a></li><li><a href="connectors.html">21) Connectors</a></li><li><a href="monitoring.html">22) Monitoring and Management</a></li><li><a href="logging.html">23) Logging</a></li><li><a href="apr.html">24) APR/Native</a></li><li><a href="virtual-hosting-howto.html">25) Virtual Hosting</a></li><li><a href="aio.html">26) Advanced IO</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><li><a href="rewrite.html">33) Rewrite</a></li><li><a href="cdi.html">34) CDI 2 and JAX-RS</a></li><li><a href="graal.html">35) AOT/GraalVM Support</a></li></ul></div><div><h2>Reference</h2><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 4.0 Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.3 Javadocs</a></li><li><a href="elapi/index.html">EL 3.0 Javadocs</a></li><li><a href="websocketapi/index.html">WebSocket 1.1 Javadocs</a></li><li><a href="jaspicapi/index.html">JASPIC 1.1 Javadocs</a></li><li><a href="annotationapi/index.html">Common Annotations 1.3 Javadocs</a></li><li><a href="https://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul></div><div><h2>Apache Tomcat Development</h2><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/Tomcat+Versions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Windows Service How-To</h2><h3 id="Table_of_Contents">Table of Contents</h3><div class="text">
5
<ul><li><a href="#Tomcat_monitor_application">Tomcat monitor application</a><ol><li><a href="#Tomcat_monitor_application/Command_line_directives">Command line directives</a></li></ol></li><li><a href="#Tomcat_service_application">Tomcat service application</a><ol><li><a href="#Tomcat_service_application/Command_line_directives">Command line directives</a></li><li><a href="#Command_line_parameters">Command line parameters</a></li></ol></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>
6
</div><h3 id="Tomcat_monitor_application">Tomcat monitor application</h3><div class="text">
7
 
8
  <p><b>Tomcat9w</b> is a GUI application for monitoring and
9
  configuring Tomcat services.</p>
10
 
11
  <div class="subsection"><h4 id="Tomcat_monitor_application/Command_line_directives">Command line directives</h4><div class="text">
12
 
13
  <p>Each command line directive is in the form of
14
  <code>//XX[//ServiceName]</code></p>
15
 
16
  <p>If the <code>//ServiceName</code> component is omitted, then the service
17
  name is assumed to be the name of the file less the w suffix. So the default
18
  service name is <code>Tomcat9</code>.</p>
19
 
20
  <p>The available command line directives are:</p>
21
 
22
  <table class="defaultTable">
23
    <tr>
24
      <td><b>//ES</b></td>
25
      <td>Edit service configuration</td>
26
      <td>This is the default operation. It is called if the no option is
27
          provided. Starts the GUI application which allows the service
28
          configuration to be modified, started and stopped.</td>
29
    </tr>
30
    <tr>
31
      <td><b>//MS</b></td>
32
      <td>Monitor service</td>
33
      <td>Starts the GUI application and minimizes it to the system tray.</td>
34
    </tr>
35
    <tr>
36
      <td><b>//MR</b></td>
37
      <td>Monitor &amp; run service</td>
38
      <td>Starts the GUI application and minimizes it to the system tray. Start
39
          the service if it is not currently running.</td>
40
    </tr>
41
    <tr>
42
      <td><b>//MQ</b></td>
43
      <td>Monitor quit</td>
44
      <td>Stop any running monitor for the service.</td>
45
    </tr>
46
  </table>
47
</div></div>
48
 
49
</div><h3 id="Tomcat_service_application">Tomcat service application</h3><div class="text">
50
 
51
  <p><b>Tomcat9</b> is a service application for running Tomcat
52
  9 as a Windows service.</p>
53
 
54
  <div class="subsection"><h4 id="Tomcat_service_application/Command_line_directives">Command line directives</h4><div class="text">
55
 
56
    <p>Each command line directive is in the form of
57
    <code>//XX[//ServiceName]</code></p>
58
 
59
    <p>The available command line directives are:</p>
60
 
61
    <table class="defaultTable">
62
      <tr>
63
        <td><b>//TS</b></td>
64
        <td>Run the service as console application</td>
65
        <td>This is the default operation. It is called if the no option is
66
            provided. The ServiceName is the name of the executable without
67
            exe suffix, meaning Tomcat9</td>
68
      </tr>
69
      <tr>
70
        <td><b>//RS</b></td>
71
        <td>Run the service</td>
72
        <td>Called only from ServiceManager</td>
73
      </tr>
74
      <tr>
75
        <td><b>//ES</b></td>
76
        <td>Start (execute) the service</td>
77
        <td></td>
78
      </tr>
79
      <tr>
80
        <td><b>//SS</b></td>
81
        <td>Stop the service</td>
82
        <td></td>
83
      </tr>
84
      <tr>
85
        <td><b>//US</b></td>
86
        <td>Update service parameters</td>
87
        <td></td>
88
      </tr>
89
      <tr>
90
        <td><b>//IS</b></td>
91
        <td>Install service</td>
92
        <td></td>
93
      </tr>
94
      <tr>
95
        <td><b>//DS</b></td>
96
        <td>Delete service</td>
97
        <td>Stops the service if running</td>
98
      </tr>
99
      <tr>
100
        <td><b>//PS</b></td>
101
        <td>Print service</td>
102
        <td>Prints the command to (re-)create the current configuration</td>
103
      </tr>
104
      <tr>
105
        <td><b>//PP[//seconds]</b></td>
106
        <td>Pause service</td>
107
        <td>Default is 60 seconds</td>
108
      </tr>
109
      <tr>
110
        <td><b>//VS</b></td>
111
        <td>Version</td>
112
        <td>Print version and exit</td>
113
      </tr>
114
      <tr>
115
        <td><b>//?</b></td>
116
        <td>Help</td>
117
        <td>Print usage and exit</td>
118
      </tr>
119
    </table>
120
  </div></div>
121
 
122
  <div class="subsection"><h4 id="Command_line_parameters">Command line parameters</h4><div class="text">
123
 
124
    <p>Each command line parameter is prefixed with <code>--</code>. If the
125
    command line parameter is prefixed with <code>++</code>, and the parameter
126
    supports multiple values, then it's value will be appended to the existing
127
    option. In the table below, parameters that support multiple values are
128
    prefixed with <code>++</code>.</p>
129
 
130
    <p>If the environment variable with the same name as command line parameter
131
    but prefixed with <code>PR_</code> exists it will take precedence. For
132
    example:</p>
133
 
134
    <div class="codeBox"><pre><code>set PR_CLASSPATH=xx.jar</code></pre></div>
135
 
136
    <p>is equivalent to providing</p>
137
 
138
    <div class="codeBox"><pre><code>--Classpath=xx.jar</code></pre></div>
139
 
140
    <p> as command line parameter.</p>
141
 
142
    <table class="defaultTable">
143
      <tr>
144
        <th>ParameterName</th>
145
        <th>Default</th>
146
        <th>Description</th>
147
      </tr>
148
      <tr>
149
        <td>--Description</td>
150
        <td></td>
151
        <td>Service name description (maximum 1024 characters)</td>
152
      </tr>
153
      <tr>
154
        <td>--DisplayName</td>
155
        <td>ServiceName</td>
156
        <td>Service display name</td>
157
      </tr>
158
      <tr>
159
        <td>--Install</td>
160
        <td>procrun.exe //RS//ServiceName</td>
161
        <td>Install image</td>
162
      </tr>
163
      <tr>
164
        <td>--Startup</td>
165
        <td>manual</td>
166
        <td>Service startup mode can be either <b>auto</b> or <b>manual</b></td>
167
      </tr>
168
      <tr>
169
        <td>++DependsOn</td>
170
        <td></td>
171
        <td>List of services that this service depend on. Dependent services are
172
            separated using either <b>#</b> or <b>;</b> characters</td>
173
      </tr>
174
      <tr>
175
        <td>++Environment</td>
176
        <td></td>
177
        <td>List of environment variables that will be provided to the service
178
            in the form <b>key=value</b>. They are separated using either
179
            <b>#</b> or <b>;</b> characters. If you need to use either the
180
            <b>#</b> or <b>;</b> character within a value then the entire value
181
            must be enclosed inside single quotes.</td>
182
      </tr>
183
      <tr>
184
        <td>--User</td>
185
        <td></td>
186
        <td>User account used for running executable. It is used only for
187
            StartMode <b>java</b> or <b>exe</b> and enables running applications
188
            as service under account without LogonAsService privilege.</td>
189
      </tr>
190
      <tr>
191
        <td>--Password</td>
192
        <td></td>
193
        <td>Password for user account set by --User parameter</td>
194
      </tr>
195
      <tr>
196
        <td>--ServiceUser</td>
197
        <td></td>
198
        <td>Specifies the name of the account under which the service should
199
            run. Use an account name in the form
200
            <code>DomainName\UserName</code>. The service process will be logged
201
            on as this user. if the account belongs to the built-in domain, you
202
            can specify <code>.\UserName</code>. Note that the Service Control
203
            Manager does not accept localised forms of the standard names so to
204
            use them you need to specify <code>NT Authority\LocalService</code>,
205
            <code>NT Authority\NetworkService</code> or <code>LocalSystem</code>
206
            as appropriate.</td>
207
      </tr>
208
      <tr>
209
        <td>--ServicePassword</td>
210
        <td></td>
211
        <td>Password for user account set by --ServiceUser parameter</td>
212
      </tr>
213
      <tr>
214
        <td>--LibraryPath</td>
215
        <td></td>
216
        <td>Directory added to the search path used to locate the DLLs for the
217
            JVM. This directory is added both in front of the <code>PATH</code>
218
            environment variable and as a parameter to the
219
            <code>SetDLLDirectory</code> function.</td>
220
      </tr>
221
      <tr>
222
        <td>--JavaHome</td>
223
        <td>JAVA_HOME</td>
224
        <td>Set a different JAVA_HOME than defined by JAVA_HOME environment
225
            variable</td>
226
      </tr>
227
      <tr>
228
        <td>--Jvm</td>
229
        <td>auto</td>
230
        <td>Use either <b>auto</b> (i.e. find the JVM from the Windows registry)
231
            or specify the full path to the <b>jvm.dll</b>.
232
            You can use the environment variable expansion here.</td>
233
      </tr>
234
      <tr>
235
        <td>++JvmOptions</td>
236
        <td>-Xrs</td>
237
        <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be
238
            passed to the JVM. The options are separated using either
239
            <b>#</b> or <b>;</b> characters. If you need to embed either <b>#</b> or
240
            <b>;</b> characters, put them inside single quotes. (Not used in
241
            <b>exe</b> mode.)</td>
242
      </tr>
243
      <tr>
244
        <td>++JvmOptions9</td>
245
        <td></td>
246
        <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be
247
            passed to the JVM when running on Java 9 or later. The options are
248
            separated using either <b>#</b> or <b>;</b> characters. If you need
249
            to embed either <b>#</b> or <b>;</b> characters, put them inside
250
            single quotes. (Not used in <b>exe</b> mode.)</td>
251
      </tr>
252
      <tr>
253
        <td>--Classpath</td>
254
        <td></td>
255
        <td>Set the Java classpath. (Not used in <b>exe</b> mode.)</td>
256
      </tr>
257
      <tr>
258
        <td>--JvmMs</td>
259
        <td></td>
260
        <td>Initial memory pool size in MiB. (Not used in <b>exe</b> mode.)</td>
261
      </tr>
262
      <tr>
263
        <td>--JvmMx</td>
264
        <td></td>
265
        <td>Maximum memory pool size in MiB. (Not used in <b>exe</b> mode.)</td>
266
      </tr>
267
      <tr>
268
        <td>--JvmSs</td>
269
        <td></td>
270
        <td>Thread stack size in KiB. (Not used in <b>exe</b> mode.)</td>
271
      </tr>
272
      <tr>
273
        <td>--StartMode</td>
274
        <td></td>
275
        <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. The modes are:
276
          <ul>
277
            <li>jvm - start Java in-process. Depends on jvm.dll, see
278
                <b>--Jvm</b>.</li>
279
            <li>Java - same as exe, but automatically uses the default Java
280
                executable, i.e. %JAVA_HOME%\bin\java.exe. Make sure JAVA_HOME
281
                is set correctly, or use --JavaHome to provide the correct
282
                location. If neither is set, procrun will try to find the
283
                default JDK (not JRE) from the Windows registry.</li>
284
            <li>exe - run the image as a separate process</li>
285
          </ul>
286
        </td>
287
      </tr>
288
      <tr>
289
        <td>--StartImage</td>
290
        <td></td>
291
        <td>Executable that will be run. Only applies to <b>exe</b> mode.</td>
292
      </tr>
293
      <tr>
294
        <td>--StartPath</td>
295
        <td></td>
296
        <td>Working path for the start image executable.</td>
297
      </tr>
298
      <tr>
299
        <td>--StartClass</td>
300
        <td>Main</td>
301
        <td>Class that contains the startup method. Applies to the <b>jvm</b> and
302
            <b>Java</b> modes. (Not used in <b>exe</b> mode.) </td>
303
      </tr>
304
      <tr>
305
        <td>--StartMethod</td>
306
        <td>main</td>
307
        <td>Method name if differs then main</td>
308
      </tr>
309
      <tr>
310
        <td>++StartParams</td>
311
        <td></td>
312
        <td>List of parameters that will be passed to either StartImage or
313
            StartClass. Parameters are separated using either <b>#</b> or
314
            <b>;</b> character.</td>
315
      </tr>
316
      <tr>
317
        <td>--StopMode</td>
318
        <td></td>
319
        <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. See <b>--StartMode</b>
320
            for further details. </td>
321
      </tr>
322
      <tr>
323
      <td>--StopImage</td>
324
        <td></td>
325
        <td>Executable that will be run on Stop service signal. Only applies to
326
            <b>exe</b> mode.</td>
327
      </tr>
328
      <tr>
329
        <td>--StopPath</td>
330
        <td></td>
331
        <td>Working path for the stop image executable. Does not apply to
332
            <b>jvm</b> mode.</td>
333
      </tr>
334
      <tr>
335
        <td>--StopClass</td>
336
        <td>Main</td>
337
        <td>Class that will be used on Stop service signal. Applies to the
338
            <b>jvm</b> and <b>Java</b> modes. </td>
339
      </tr>
340
      <tr>
341
        <td>--StopMethod</td>
342
        <td>main</td>
343
        <td>Method name if differs then main</td>
344
      </tr>
345
      <tr>
346
        <td>--StopParams</td>
347
        <td></td>
348
        <td>List of parameters that will be passed to either StopImage or
349
            StopClass. Parameters are separated using either <b>#</b> or
350
            <b>;</b> character.</td>
351
      </tr>
352
      <tr>
353
        <td>++StopTimeout</td>
354
        <td>No Timeout</td>
355
        <td>Defines the timeout in seconds that procrun waits for service to
356
            exit gracefully.</td>
357
      </tr>
358
      <tr>
359
        <td>--LogPath</td>
360
        <td>%SystemRoot%\System32\LogFiles\Apache</td>
361
        <td>Defines the path for logging. Creates the directory if
362
            necessary.</td>
363
      </tr>
364
      <tr>
365
        <td>--LogPrefix</td>
366
        <td>commons-daemon</td>
367
        <td>Defines the service log filename prefix. The log file is created in
368
            the LogPath directory with <code>.YEAR-MONTH-DAY.log</code>
369
            suffix</td>
370
      </tr>
371
      <tr>
372
        <td>--LogLevel</td>
373
        <td>Info</td>
374
        <td>Defines the logging level and can be either <b>Error</b>,
375
            <b>Info</b>, <b>Warn</b> or <b>Debug</b>. (Case insensitive).</td>
376
      </tr>
377
      <tr>
378
        <td>--LogJniMessages</td>
379
        <td>0</td>
380
        <td>Set this non-zero (e.g. 1) to capture JVM jni debug messages in the
381
            procrun log file. Is not needed if stdout/stderr redirection is
382
            being used. Only applies to jvm mode.</td>
383
      </tr>
384
      <tr>
385
        <td>--StdOutput</td>
386
        <td></td>
387
        <td>Redirected stdout filename.
388
            If named <b>auto</b> then file is created inside <b>LogPath</b> with
389
            the name <b>service-stdout.YEAR-MONTH-DAY.log</b>.</td>
390
      </tr>
391
      <tr>
392
        <td>--StdError</td>
393
        <td></td>
394
        <td>Redirected stderr filename.
395
            If named <b>auto</b> then file is created inside <b>LogPath</b> with
396
            the name <b>service-stderr.YEAR-MONTH-DAY.log</b>.</td>
397
      </tr>
398
      <tr>
399
        <td>--PidFile</td>
400
        <td></td>
401
        <td>Defines the file name for storing the running process id. Actual
402
        file is created in the <b>LogPath</b> directory</td>
403
      </tr>
404
    </table>
405
  </div></div>
406
</div><h3 id="Installing_services">Installing services</h3><div class="text">
407
<p>
408
The safest way to manually install the service is to use the provided
409
<b>service.bat</b> script. Administrator privileges are required to run this
410
script. If necessary, you can use the <code>/user</code> switch to specify
411
a user to use for the installation of the service.
412
</p>
413
<p>
414
<strong>NOTE:</strong> If User Account Control (UAC) is enabled you will be
415
asked for additional privileges when 'Tomcat9.exe' is launched by
416
the script.<br>
417
If you want to pass additional options to service installer as
418
<code>PR_*</code> environment variables, you have to either configure them
419
globally in OS, or launch the program that sets them with elevated privileges
420
(e.g. right-click on cmd.exe and select "Run as administrator"; on Windows 8
421
(or later) or Windows Server 2012 (or later), you can open an elevated command
422
prompt for the current directory from the Explorer
423
by clicking on the "File" menu bar). See issue <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56143">56143</a> for details.
424
</p>
425
 
426
<div class="codeBox"><pre><code>Install the service named 'Tomcat9'
427
C:\&gt; service.bat install</code></pre></div>
428
 
429
<p>There is a 2nd optional parameter that lets you specify the name of the
430
service, as displayed in Windows services.</p>
431
 
432
<div class="codeBox"><pre><code>Install the service named 'MyService'
433
C:\&gt; service.bat install MyService</code></pre></div>
434
 
435
<p>When installing the service with a non-default name,
436
tomcat9.exe and tomcat9w.exe may be renamed to
437
match the chosen service name. To do this, use the <code>--rename</code>
438
option.</p>
439
 
440
<div class="codeBox"><pre><code>Install the service named 'MyService' with renaming
441
C:\&gt; service.bat install MyService --rename</code></pre></div>
442
 
443
<p>
444
If using tomcat9.exe, you need to use the <b>//IS</b> parameter.</p>
445
 
446
<div class="codeBox"><pre><code>Install the service named 'Tomcat9'
447
C:\&gt; tomcat9 //IS//Tomcat9 --DisplayName="Apache Tomcat 9" ^
448
     --Install="C:\Program Files\Tomcat\bin\tomcat9.exe" --Jvm=auto ^
449
     --StartMode=jvm --StopMode=jvm ^
450
     --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start ^
451
     --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop</code></pre></div>
452
 
453
</div><h3 id="Updating_services">Updating services</h3><div class="text">
454
<p>
455
To update the service parameters, you need to use the <b>//US</b> parameter.
456
</p>
457
 
458
<div class="codeBox"><pre><code>Update the service named 'Tomcat9'
459
C:\&gt; tomcat9 //US//Tomcat9 --Description="Apache Tomcat Server - https://tomcat.apache.org/ " ^
460
     --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar</code></pre></div>
461
 
462
<p>If you gave the service an optional name, you need to specify it like this:
463
</p>
464
 
465
<div class="codeBox"><pre><code>Update the service named 'MyService'
466
C:\&gt; tomcat9 //US//MyService --Description="Apache Tomcat Server - https://tomcat.apache.org/ " ^
467
     --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar</code></pre></div>
468
 
469
</div><h3 id="Removing_services">Removing services</h3><div class="text">
470
<p>
471
To remove the service, you need to use the <b>//DS</b> parameter.<br>
472
If the service is running it will be stopped and then deleted.</p>
473
 
474
<div class="codeBox"><pre><code>Remove the service named 'Tomcat9'
475
C:\&gt; tomcat9 //DS//Tomcat9</code></pre></div>
476
 
477
<p>If you gave the service an optional name, you need to specify it like this:
478
</p>
479
 
480
<div class="codeBox"><pre><code>Remove the service named 'MyService'
481
C:\&gt; tomcat9 //DS//MyService</code></pre></div>
482
 
483
</div><h3 id="Debugging_services">Debugging services</h3><div class="text">
484
<p>
485
To run the service in console mode, you need to use the <b>//TS</b> parameter.
486
The service shutdown can be initiated by pressing <b>CTRL+C</b> or
487
<b>CTRL+BREAK</b>.
488
If you rename the tomcat9.exe to testservice.exe then you can just execute the
489
testservice.exe and this command mode will be executed by default.</p>
490
 
491
<div class="codeBox"><pre><code>Run the service named 'Tomcat9' in console mode
492
C:\&gt; tomcat9 //TS//Tomcat9 [additional arguments]
493
Or simply execute:
494
C:\&gt; tomcat9</code></pre></div>
495
 
496
</div><h3 id="Multiple_Instances">Multiple Instances</h3><div class="text">
497
<p>
498
Tomcat supports installation of multiple instances. You can have a single
499
installation of Tomcat with multiple instances running on different IP/port
500
combinations, or multiple Tomcat versions, each running one or more instances on
501
different IP/ports.</p>
502
<p>
503
Each instance folder will need the following structure:
504
</p>
505
<ul>
506
<li>conf</li>
507
<li>logs</li>
508
<li>temp</li>
509
<li>webapps</li>
510
<li>work</li>
511
</ul>
512
<p>
513
At a minimum, conf should contain a copy of the following files from
514
CATALINA_HOME\conf\. Any files not copied and edited, will be picked up by
515
default from CATALINA_HOME\conf, i.e. CATALINA_BASE\conf files override defaults
516
from CATALINA_HOME\conf.</p>
517
<ul>
518
<li>server.xml</li>
519
<li>web.xml</li>
520
</ul>
521
<p>
522
You must edit CATALINA_BASE\conf\server.xml to specify a unique IP/port for the
523
instance to listen on. Find the line that contains
524
<code>&lt;Connector port="8080" ...</code> and add an address attribute and/or
525
update the port number so as to specify a unique IP/port combination.</p>
526
<p>
527
To install an instance, first set the CATALINA_HOME environment variable to the
528
name of the Tomcat installation directory. Then create a second environment
529
variable CATALINA_BASE and point this to the instance folder. Then run
530
"service.bat install" command specifying a service name.</p>
531
 
532
<div class="codeBox"><pre><code>set CATALINA_HOME=c:\tomcat_9
533
set CATALINA_BASE=c:\tomcat_9\instances\instance1
534
service.bat install instance1</code></pre></div>
535
 
536
<p>
537
To modify the service settings, you can run <b>tomcat9w //ES//instance1</b>.
538
</p>
539
<p>
540
For additional instances, create additional instance folder, update the
541
CATALINA_BASE environment variable, and run the "service.bat install" again.</p>
542
 
543
<div class="codeBox"><pre><code>set CATALINA_BASE=c:\tomcat_9\instances\instance2
544
service.bat install instance2</code></pre></div>
545
 
546
</div></div></div></div></div><footer><div id="footer">
547
    Copyright &copy; 1999-2025, The Apache Software Foundation
548
    <br>
549
    Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo
550
    are either registered trademarks or trademarks of the Apache Software
551
    Foundation.
552
    </div></footer></div></body></html>