刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.77) - 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 |
|
| 8 |
|
| 9 | table {
|
| 10 | border-collapse: collapse;
|
| 11 | text-align: left;
|
| 12 | }
|
| 13 | table *:not(table) {
|
| 14 | /* Prevent border-collapsing for table child elements like <div> */
|
| 15 | border-collapse: separate;
|
| 16 | }
|
| 17 |
|
| 18 | th {
|
| 19 | text-align: left;
|
| 20 | }
|
| 21 |
|
| 22 |
|
| 23 | div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
|
| 24 | background-color: transparent;
|
| 25 | }
|
| 26 | div.codeBox {
|
| 27 | overflow: auto;
|
| 28 | margin: 1em 0;
|
| 29 | }
|
| 30 | div.codeBox pre {
|
| 31 | margin: 0;
|
| 32 | padding: 4px;
|
| 33 | border: 1px solid #999;
|
| 34 | border-radius: 5px;
|
| 35 | background-color: #eff8ff;
|
| 36 | display: table; /* To prevent <pre>s from taking the complete available width. */
|
| 37 | /*
|
| 38 | When it is officially supported, use the following CSS instead of display: table
|
| 39 | to prevent big <pre>s from exceeding the browser window:
|
| 40 | max-width: available;
|
| 41 | width: min-content;
|
| 42 | */
|
| 43 | }
|
| 44 |
|
| 45 | div.codeBox pre.wrap {
|
| 46 | white-space: pre-wrap;
|
| 47 | }
|
| 48 |
|
| 49 |
|
| 50 | table.defaultTable tr, table.detail-table tr {
|
| 51 | border: 1px solid #CCC;
|
| 52 | }
|
| 53 |
|
| 54 | table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
|
| 55 | background-color: #FAFBFF;
|
| 56 | }
|
| 57 |
|
| 58 | table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
|
| 59 | background-color: #EEEFFF;
|
| 60 | }
|
| 61 |
|
| 62 | table.defaultTable th, table.detail-table th {
|
| 63 | background-color: #88b;
|
| 64 | color: #fff;
|
| 65 | }
|
| 66 |
|
| 67 | table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
|
| 68 | padding: 5px 8px;
|
| 69 | }
|
| 70 |
|
| 71 |
|
| 72 | p.notice {
|
| 73 | border: 1px solid rgb(255, 0, 0);
|
| 74 | background-color: rgb(238, 238, 238);
|
| 75 | color: rgb(0, 51, 102);
|
| 76 | padding: 0.5em;
|
| 77 | margin: 1em 2em 1em 1em;
|
| 78 | }
|
| 79 | </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="
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 80 | The Apache Tomcat Servlet/JSP Container
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 81 | " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></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/TLS</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-descriptors-howto.html">16) MBeans Descriptors</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="websocketapi/index.html">WebSocket 1.1 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>
|
| 82 | <ul><li><a href="#Tomcat_service_application">Tomcat service application</a></li><li><a href="#Tomcat_monitor_application">Tomcat 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>
|
| 83 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Tomcat service application"><!--()--></a><a name="Tomcat_service_application"><strong>Tomcat service application</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 84 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 85 | <b>Tomcat7</b> is a service application for running Tomcat
|
| 86 | 7 as a Windows service.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 87 | </p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 88 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Tomcat monitor application"><!--()--></a><a name="Tomcat_monitor_application"><strong>Tomcat monitor application</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 89 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 90 | <b>Tomcat7w</b> is a GUI application for monitoring and
|
| 91 | configuring Tomcat services.
|
| 92 | </p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 93 | <p>The available command line options are:</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 94 |
|
| 95 | <table class="defaultTable">
|
| 96 | <tr><td><b>//ES//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 97 | <td>Edit service configuration</td>
|
| 98 | <td>This is the default operation. It is called if the no option is
|
| 99 | provided but the executable is renamed to <b>servicenameW.exe</b></td>
|
| 100 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 101 | <tr><td><b>//MS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 102 | <td>Monitor service</td>
|
| 103 | <td>Put the icon in the system tray</td>
|
| 104 | </tr>
|
| 105 | </table>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 106 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 107 | </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>
|
| 108 | <p>
|
| 109 | Each command line directive is in the form of <b>//XX//ServiceName</b>
|
| 110 | </p>
|
| 111 | <p>The available command line options are:</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 112 |
|
| 113 | <table class="defaultTable">
|
| 114 | <tr><td><b>//TS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 115 | <td>Run the service as console application</td>
|
| 116 | <td>This is the default operation. It is called if the no option is
|
| 117 | provided. The ServiceName is the name of the executable without
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 118 | exe suffix, meaning Tomcat7</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 119 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 120 | <tr><td><b>//RS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 121 | <td>Run the service</td>
|
| 122 | <td>Called only from ServiceManager</td>
|
| 123 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 124 | <tr><td><b>//SS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 125 | <td>Stop the service</td>
|
| 126 | <td></td>
|
| 127 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 128 | <tr><td><b>//US//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 129 | <td>Update service parameters</td>
|
| 130 | <td></td>
|
| 131 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 132 | <tr><td><b>//IS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 133 | <td>Install service</td>
|
| 134 | <td></td>
|
| 135 | </tr>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 136 | <tr><td><b>//DS//</b></td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 137 | <td>Delete service</td>
|
| 138 | <td>Stops the service if running</td>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 139 | </tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 140 | </table>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 141 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 142 | </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>
|
| 143 | <p>
|
| 144 | Each command parameter is prefixed with <b>--</b>.
|
| 145 | If the command line is prefixed with <b>++</b> then it's value will
|
| 146 | be appended to the existing option.
|
| 147 | If the environment variable with the same name as command line parameter but
|
| 148 | prefixed with <code>PR_</code> exists it will take precedence.
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 149 | For example:</p>
|
| 150 | <div class="codeBox"><pre><code>set PR_CLASSPATH=xx.jar</code></pre></div>
|
| 151 |
|
| 152 | <p>is equivalent to providing</p>
|
| 153 | <div class="codeBox"><pre><code>--Classpath=xx.jar</code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 154 | <p> as command line parameter.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 155 |
|
| 156 | <table class="defaultTable">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 157 | <tr>
|
| 158 | <th>ParameterName</th>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 159 | <th>Default</th>
|
| 160 | <th>Description</th>
|
| 161 | </tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 162 | <tr>
|
| 163 | <td>--Description</td>
|
| 164 | <td></td>
|
| 165 | <td>Service name description (maximum 1024 characters)</td>
|
| 166 | </tr>
|
| 167 | <tr>
|
| 168 | <td>--DisplayName</td>
|
| 169 | <td>ServiceName</td>
|
| 170 | <td>Service display name</td>
|
| 171 | </tr>
|
| 172 | <tr>
|
| 173 | <td>--Install</td>
|
| 174 | <td>procrun.exe //RS//ServiceName</td>
|
| 175 | <td>Install image</td>
|
| 176 | </tr>
|
| 177 | <tr>
|
| 178 | <td>--Startup</td>
|
| 179 | <td>manual</td>
|
| 180 | <td>Service startup mode can be either <b>auto</b> or <b>manual</b></td>
|
| 181 | </tr>
|
| 182 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 183 | <td>++DependsOn</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 184 | <td></td>
|
| 185 | <td>List of services that this service depend on. Dependent services
|
| 186 | are separated using either <b>#</b> or <b>;</b> characters</td>
|
| 187 | </tr>
|
| 188 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 189 | <td>++Environment</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 190 | <td></td>
|
| 191 | <td>List of environment variables that will be provided to the service
|
| 192 | in the form <b>key=value</b>. They are separated using either
|
| 193 | <b>#</b> or <b>;</b> characters. If you need to use either the <b>#</b>
|
| 194 | or <b>;</b> character within a value then the entire value must be
|
| 195 | enclosed inside single quotes.</td>
|
| 196 | </tr>
|
| 197 | <tr>
|
| 198 | <td>--User</td>
|
| 199 | <td></td>
|
| 200 | <td>User account used for running executable. It is used only for
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 201 | StartMode <b>java</b> or <b>exe</b> and enables running applications
|
| 202 | as service under account without LogonAsService privilege.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 203 | </tr>
|
| 204 | <tr>
|
| 205 | <td>--Password</td>
|
| 206 | <td></td>
|
| 207 | <td>Password for user account set by --User parameter</td>
|
| 208 | </tr>
|
| 209 | <tr>
|
| 210 | <td>--JavaHome</td>
|
| 211 | <td>JAVA_HOME</td>
|
| 212 | <td>Set a different JAVA_HOME than defined by JAVA_HOME environment
|
| 213 | variable</td>
|
| 214 | </tr>
|
| 215 | <tr>
|
| 216 | <td>--Jvm</td>
|
| 217 | <td>auto</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 218 | <td>Use either <b>auto</b> (i.e. find the JVM from the Windows registry)
|
| 219 | or specify the full path to the <b>jvm.dll</b>.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 220 | You can use the environment variable expansion here.</td>
|
| 221 | </tr>
|
| 222 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 223 | <td>++JvmOptions</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 224 | <td>-Xrs</td>
|
| 225 | <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be
|
| 226 | passed to the JVM. The options are separated using either
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 227 | <b>#</b> or <b>;</b> characters. (Not used in <b>exe</b> mode.)</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 228 | </tr>
|
| 229 | <tr>
|
| 230 | <td>--Classpath</td>
|
| 231 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 232 | <td>Set the Java classpath. (Not used in <b>exe</b> mode.)</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 233 | </tr>
|
| 234 | <tr>
|
| 235 | <td>--JvmMs</td>
|
| 236 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 237 | <td>Initial memory pool size in MB. (Not used in <b>exe</b> mode.)</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 238 | </tr>
|
| 239 | <tr>
|
| 240 | <td>--JvmMx</td>
|
| 241 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 242 | <td>Maximum memory pool size in MB. (Not used in <b>exe</b> mode.)</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 243 | </tr>
|
| 244 | <tr>
|
| 245 | <td>--JvmSs</td>
|
| 246 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 247 | <td>Thread stack size in KB. (Not used in <b>exe</b> mode.)</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 248 | </tr>
|
| 249 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 250 | <td>--StartMode</td>
|
| 251 | <td></td>
|
| 252 | <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. The modes are:
|
| 253 | <ul>
|
| 254 | <li>jvm - start Java in-process. Depends on jvm.dll, see <b>--Jvm</b>.</li>
|
| 255 | <li>Java - same as exe, but automatically uses the default Java
|
| 256 | executable, i.e. %JAVA_HOME%\bin\java.exe. Make sure JAVA_HOME is set
|
| 257 | correctly, or use --JavaHome to provide the correct location.
|
| 258 | If neither is set, procrun will try to find the default JDK (not JRE)
|
| 259 | from the Windows registry.</li>
|
| 260 | <li>exe - run the image as a separate process</li>
|
| 261 | </ul>
|
| 262 | </td>
|
| 263 | </tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 264 | <tr>
|
| 265 | <td>--StartImage</td>
|
| 266 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 267 | <td>Executable that will be run. Only applies to <b>exe</b> mode.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 268 | </tr>
|
| 269 | <tr>
|
| 270 | <td>--StartPath</td>
|
| 271 | <td></td>
|
| 272 | <td>Working path for the start image executable.</td>
|
| 273 | </tr>
|
| 274 | <tr>
|
| 275 | <td>--StartClass</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 276 | <td>Main</td>
|
| 277 | <td>Class that contains the startup method. Applies to the <b>jvm</b> and
|
| 278 | <b>Java</b> modes. (Not used in <b>exe</b> mode.) </td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 279 | </tr>
|
| 280 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 281 | <td>--StartMethod</td>
|
| 282 | <td>main</td>
|
| 283 | <td>Method name if differs then main</td>
|
| 284 | </tr>
|
| 285 | <tr>
|
| 286 | <td>++StartParams</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 287 | <td></td>
|
| 288 | <td>List of parameters that will be passed to either StartImage or
|
| 289 | StartClass. Parameters are separated using either <b>#</b> or
|
| 290 | <b>;</b> character.</td>
|
| 291 | </tr>
|
| 292 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 293 | <td>--StopMode</td>
|
| 294 | <td></td>
|
| 295 | <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. See <b>--StartMode</b>
|
| 296 | for further details. </td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 297 | </tr>
|
| 298 | <tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 299 | <td>--StopImage</td>
|
| 300 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 301 | <td>Executable that will be run on Stop service signal. Only applies to
|
| 302 | <b>exe</b> mode.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 303 | </tr>
|
| 304 | <tr>
|
| 305 | <td>--StopPath</td>
|
| 306 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 307 | <td>Working path for the stop image executable. Does not apply to <b>jvm</b>
|
| 308 | mode.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 309 | </tr>
|
| 310 | <tr>
|
| 311 | <td>--StopClass</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 312 | <td>Main</td>
|
| 313 | <td>Class that will be used on Stop service signal. Applies to the
|
| 314 | <b>jvm</b> and <b>Java</b> modes. </td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 315 | </tr>
|
| 316 | <tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 317 | <td>--StopMethod</td>
|
| 318 | <td>main</td>
|
| 319 | <td>Method name if differs then main</td>
|
| 320 | </tr>
|
| 321 | <tr>
|
| 322 | <td>++StopParams</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 323 | <td></td>
|
| 324 | <td>List of parameters that will be passed to either StopImage or
|
| 325 | StopClass. Parameters are separated using either <b>#</b> or
|
| 326 | <b>;</b> character.</td>
|
| 327 | </tr>
|
| 328 | <tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 329 | <td>--StopTimeout</td>
|
| 330 | <td>No Timeout</td>
|
| 331 | <td>Defines the timeout in seconds that procrun waits for service to
|
| 332 | exit gracefully.</td>
|
| 333 | </tr>
|
| 334 | <tr>
|
| 335 | <td>--LogPath</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 336 | <td>%SystemRoot%\System32\LogFiles\Apache</td>
|
| 337 | <td>Defines the path for logging. Creates the directory if necessary.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 338 | </tr>
|
| 339 | <tr>
|
| 340 | <td>--LogPrefix</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 341 | <td>commons-daemon</td>
|
| 342 | <td>Defines the service log filename prefix. The log file is created in the
|
| 343 | LogPath directory with <code>.YEAR-MONTH-DAY.log</code> suffix</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 344 | </tr>
|
| 345 | <tr>
|
| 346 | <td>--LogLevel</td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 347 | <td>Info</td>
|
| 348 | <td>Defines the logging level and can be either <b>Error</b>,
|
| 349 | <b>Info</b>, <b>Warn</b> or <b>Debug</b>. (Case insensitive).</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 350 | </tr>
|
| 351 | <tr>
|
| 352 | <td>--StdOutput</td>
|
| 353 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 354 | <td>Redirected stdout filename.
|
| 355 | If named <b>auto</b> then file is created inside <b>LogPath</b> with the
|
| 356 | name <b>service-stdout.YEAR-MONTH-DAY.log</b>.</td>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 357 | </tr>
|
| 358 | <tr>
|
| 359 | <td>--StdError</td>
|
| 360 | <td></td>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 361 | <td>Redirected stderr filename.
|
| 362 | If named <b>auto</b> then file is created inside <b>LogPath</b> with the
|
| 363 | name <b>service-stderr.YEAR-MONTH-DAY.log</b>.</td>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 364 | </tr>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 365 | <tr>
|
| 366 | <td>--PidFile</td>
|
| 367 | <td></td>
|
| 368 | <td>Defines the file name for storing the running process id. Actual file is
|
| 369 | created in the <b>LogPath</b> directory</td>
|
| 370 | </tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 371 | </table>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 372 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 373 | </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>
|
| 374 | <p>
|
| 375 | The safest way to manually install the service is to use the provided
|
| 376 | <b>service.bat</b> script. Administrator privileges are required to run this
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 377 | script. If necessary, you can use the <code>/user</code> switch to specify
|
| 378 | a user to use for the installation of the service.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 379 | </p>
|
| 380 | <p>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 381 | <strong>NOTE:</strong> On Windows Vista or any later operating system with User
|
| 382 | Account Control (UAC) enabled you will be asked for additional privileges
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 383 | when 'Tomcat7.exe' is launched by the script.<br>
|
Hongqing Liu | 7189829 | 2014-10-15 13:31:32 +0800 | [diff] [blame] | 384 | If you want to pass additional options to service installer as
|
| 385 | <code>PR_*</code> environment variables, you have to either configure them
|
| 386 | globally in OS, or launch the program that sets them with elevated privileges
|
| 387 | (e.g. right-click on cmd.exe and select "Run as administrator"; on Windows 8
|
| 388 | (or later) or Windows Server 2012 (or later), you can open an elevated command
|
| 389 | prompt for the current directory from the Explorer
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 390 | by clicking on the "File" menu bar). See issue <a href="http://bz.apache.org/bugzilla/show_bug.cgi?id=56143">56143</a> for details.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 391 | </p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 392 |
|
| 393 | <div class="codeBox"><pre><code>Install the service named 'Tomcat7'
|
| 394 | C:\> service.bat install</code></pre></div>
|
| 395 |
|
| 396 | <p>There is a 2nd optional parameter that lets you specify the name of the
|
| 397 | service, as displayed in Windows services.</p>
|
| 398 |
|
| 399 | <div class="codeBox"><pre><code>Install the service named 'MyService'
|
| 400 | C:\> service.bat install MyService</code></pre></div>
|
| 401 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 402 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 403 | If using tomcat7.exe, you need to use the <b>//IS//</b> parameter.</p>
|
| 404 |
|
| 405 | <div class="codeBox"><pre><code>Install the service named 'Tomcat7'
|
| 406 | C:\> tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" ^
|
| 407 | --Install="C:\Program Files\Tomcat\bin\tomcat7.exe" --Jvm=auto ^
|
| 408 | --StartMode=jvm --StopMode=jvm ^
|
| 409 | --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start ^
|
| 410 | --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop</code></pre></div>
|
| 411 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 412 | </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>
|
| 413 | <p>
|
| 414 | To update the service parameters, you need to use the <b>//US//</b> parameter.
|
| 415 | </p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 416 |
|
| 417 | <div class="codeBox"><pre><code>Update the service named 'Tomcat7'
|
| 418 | C:\> tomcat7 //US//Tomcat7 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " ^
|
| 419 | --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar</code></pre></div>
|
| 420 |
|
| 421 | <p>If you gave the service an optional name, you need to specify it like this:
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 422 | </p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 423 |
|
| 424 | <div class="codeBox"><pre><code>Update the service named 'MyService'
|
| 425 | C:\> tomcat7 //US//MyService --Description="Apache Tomcat Server - http://tomcat.apache.org/ " ^
|
| 426 | --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar</code></pre></div>
|
| 427 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 428 | </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>
|
| 429 | <p>
|
| 430 | To remove the service, you need to use the <b>//DS//</b> parameter.<br>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 431 | If the service is running it will be stopped and then deleted.</p>
|
| 432 |
|
| 433 | <div class="codeBox"><pre><code>Remove the service named 'Tomcat7'
|
| 434 | C:\> tomcat7 //DS//Tomcat7</code></pre></div>
|
| 435 |
|
| 436 | <p>If you gave the service an optional name, you need to specify it like this:
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 437 | </p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 438 |
|
| 439 | <div class="codeBox"><pre><code>Remove the service named 'MyService'
|
| 440 | C:\> tomcat7 //DS//MyService</code></pre></div>
|
| 441 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 442 | </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>
|
| 443 | <p>
|
| 444 | To run the service in console mode, you need to use the <b>//TS//</b> parameter.
|
| 445 | The service shutdown can be initiated by pressing <b>CTRL+C</b> or
|
| 446 | <b>CTRL+BREAK</b>.
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 447 | If you rename the tomcat7.exe to testservice.exe then you can just execute the
|
| 448 | testservice.exe and this command mode will be executed by default.</p>
|
| 449 |
|
| 450 | <div class="codeBox"><pre><code>Run the service named 'Tomcat7' in console mode
|
| 451 | C:\> tomcat7 //TS//Tomcat7 [additional arguments]
|
| 452 | Or simply execute:
|
| 453 | C:\> tomcat7</code></pre></div>
|
| 454 |
|
| 455 | </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>
|
| 456 | <p>
|
| 457 | Tomcat supports installation of multiple instances. You can have a single
|
| 458 | installation of Tomcat with multiple instances running on different IP/port
|
| 459 | combinations, or multiple Tomcat versions, each running one or more instances on
|
| 460 | different IP/ports.</p>
|
| 461 | <p>
|
| 462 | Each instance folder will need the following structure:
|
| 463 | </p>
|
| 464 | <ul>
|
| 465 | <li>conf</li>
|
| 466 | <li>logs</li>
|
| 467 | <li>temp</li>
|
| 468 | <li>webapps</li>
|
| 469 | <li>work</li>
|
| 470 | </ul>
|
| 471 | <p>
|
| 472 | At a minimum, conf should contain a copy of the following files from
|
| 473 | CATALINA_HOME\conf\. Any files not copied and edited, will be picked up by
|
| 474 | default from CATALINA_HOME\conf, i.e. CATALINA_BASE\conf files override defaults
|
| 475 | from CATALINA_HOME\conf.</p>
|
| 476 | <ul>
|
| 477 | <li>server.xml</li>
|
| 478 | <li>web.xml</li>
|
| 479 | </ul>
|
| 480 | <p>
|
| 481 | You must edit CATALINA_BASE\conf\server.xml to specify a unique IP/port for the
|
| 482 | instance to listen on. Find the line that contains
|
| 483 | <code><Connector port="8080" ...</code> and add an address attribute and/or
|
| 484 | update the port number so as to specify a unique IP/port combination.</p>
|
| 485 | <p>
|
| 486 | To install an instance, first set the CATALINA_HOME environment variable to the
|
| 487 | name of the Tomcat installation directory. Then create a second environment
|
| 488 | variable CATALINA_BASE and point this to the instance folder. Then run "service
|
| 489 | install" command specifying a service name.</p>
|
| 490 |
|
| 491 | <div class="codeBox"><pre><code>set CATALINA_HOME=c:\tomcat_7
|
| 492 | set CATALINA_BASE=c:\tomcat_7\instances\instance1
|
| 493 | service install instance1</code></pre></div>
|
| 494 |
|
| 495 | <p>
|
| 496 | To modify the service settings, you can run <b>tomcat7w //ES//instance1</b>.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 497 | </p>
|
| 498 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 499 | For additional instances, create additional instance folder, update the
|
| 500 | CATALINA_BASE environment variable, and run the service install again.</p>
|
| 501 |
|
| 502 | <div class="codeBox"><pre><code>set CATALINA_BASE=c:\tomcat_7\instances\instance2
|
| 503 | service install instance2</code></pre></div>
|
| 504 |
|
| 505 | </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
|
| 506 | on improving documentation for Apache Tomcat.<br><br>
|
| 507 | If you have trouble and need help, read
|
| 508 | <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
|
| 509 | and ask your question on the tomcat-users
|
| 510 | <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
|
| 511 | Do not ask such questions here. This is not a Q&A section.<br><br>
|
| 512 | The Apache Comments System is explained <a href="./comments.html">here</a>.
|
| 513 | Comments may be removed by our moderators if they are either
|
| 514 | implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
|
| 515 | var comments_shortname = 'tomcat';
|
| 516 | var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html';
|
| 517 | (function(w, d) {
|
| 518 | if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
|
| 519 | d.write('<div id="comments_thread"><\/div>');
|
| 520 | var s = d.createElement('script');
|
| 521 | s.type = 'text/javascript';
|
| 522 | s.async = true;
|
| 523 | s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
|
| 524 | (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
|
| 525 | }
|
| 526 | else {
|
| 527 | d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
|
| 528 | }
|
| 529 | })(window, document);
|
| 530 | //--><!]]></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>
|
| 531 | Copyright © 1999-2017, Apache Software Foundation
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 532 | </em></font></div></td></tr></table></body></html> |