blob: d28230a19a1d11634c5885231dd605c72d77b2fd [file] [log] [blame]
刘洪青6266f992017-05-15 21:21:03 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.77) - Manager App HOW-TO</title><meta name="author" content="Craig R. McClanahan"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4</style><style type="text/css">
5code {background-color:rgb(224,255,255);padding:0 0.1em;}
6code.attributeName, code.propertyName {background-color:transparent;}
7
8
9table {
10 border-collapse: collapse;
11 text-align: left;
12}
13table *:not(table) {
14 /* Prevent border-collapsing for table child elements like <div> */
15 border-collapse: separate;
16}
17
18th {
19 text-align: left;
20}
21
22
23div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
24 background-color: transparent;
25}
26div.codeBox {
27 overflow: auto;
28 margin: 1em 0;
29}
30div.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
45div.codeBox pre.wrap {
46 white-space: pre-wrap;
47}
48
49
50table.defaultTable tr, table.detail-table tr {
51 border: 1px solid #CCC;
52}
53
54table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
55 background-color: #FAFBFF;
56}
57
58table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
59 background-color: #EEEFFF;
60}
61
62table.defaultTable th, table.detail-table th {
63 background-color: #88b;
64 color: #fff;
65}
66
67table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
68 padding: 5px 8px;
69}
70
71
72p.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 Liufd5ee812014-05-10 16:32:51 +080080 The Apache Tomcat Servlet/JSP Container
刘洪青6266f992017-05-15 21:21:03 +080081 " 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>Manager App 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="#Introduction">Introduction</a></li><li><a href="#Configuring_Manager_Application_Access">Configuring Manager Application Access</a></li><li><a href="#HTML_User-friendly_Interface">HTML User-friendly Interface</a></li><li><a href="#Supported_Manager_Commands">Supported Manager Commands</a><ol><li><a href="#Common_Parameters">Common Parameters</a></li><li><a href="#Deploy_A_New_Application_Archive_(WAR)_Remotely">Deploy A New Application Archive (WAR) Remotely</a></li><li><a href="#Deploy_A_New_Application_from_a_Local_Path">Deploy A New Application from a Local Path</a><ol><li><a href="#Deploy_a_previously_deployed_webapp">Deploy a previously deployed webapp</a></li><li><a href="#Deploy_a_Directory_or_WAR_by_URL">Deploy a Directory or WAR by URL</a></li><li><a href="#Deploy_a_Directory_or_War_from_the_Host_appBase">Deploy a Directory or War from the Host appBase</a></li><li><a href="#Deploy_using_a_Context_configuration_%22.xml%22_file">Deploy using a Context configuration ".xml" file</a></li><li><a href="#Deployment_Notes">Deployment Notes</a></li><li><a href="#Deploy_Response">Deploy Response</a></li></ol></li><li><a href="#List_Currently_Deployed_Applications">List Currently Deployed Applications</a></li><li><a href="#Reload_An_Existing_Application">Reload An Existing Application</a></li><li><a href="#List_OS_and_JVM_Properties">List OS and JVM Properties</a></li><li><a href="#List_Available_Global_JNDI_Resources">List Available Global JNDI Resources</a></li><li><a href="#Session_Statistics">Session Statistics</a></li><li><a href="#Expire_Sessions">Expire Sessions</a></li><li><a href="#Start_an_Existing_Application">Start an Existing Application</a></li><li><a href="#Stop_an_Existing_Application">Stop an Existing Application</a></li><li><a href="#Undeploy_an_Existing_Application">Undeploy an Existing Application</a></li><li><a href="#Finding_memory_leaks">Finding memory leaks</a></li><li><a href="#Thread_Dump">Thread Dump</a></li><li><a href="#VM_Info">VM Info</a></li></ol></li><li><a href="#Server_Status">Server Status</a></li><li><a href="#Using_the_JMX_Proxy_Servlet">Using the JMX Proxy Servlet</a><ol><li><a href="#What_is_JMX_Proxy_Servlet">What is JMX Proxy Servlet</a></li><li><a href="#JMX_Query_command">JMX Query command</a></li><li><a href="#JMX_Get_command">JMX Get command</a></li><li><a href="#JMX_Set_command">JMX Set command</a></li><li><a href="#JMX_Invoke_command">JMX Invoke command</a></li></ol></li><li><a href="#Executing_Manager_Commands_With_Ant">Executing Manager Commands With Ant</a><ol><li><a href="#Tasks_output_capture">Tasks output capture</a></li></ol></li></ul>
Hongqing Liufd5ee812014-05-10 16:32:51 +080083</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
84
85<p>In many production environments, it is very useful to have the capability
86to deploy a new web application, or undeploy an existing one, without having
87to shut down and restart the entire container. In addition, you can request
88an existing application to reload itself, even if you have not declared it
刘洪青6266f992017-05-15 21:21:03 +080089to be <code>reloadable</code> in the Tomcat server
Hongqing Liufd5ee812014-05-10 16:32:51 +080090configuration file.</p>
91
刘洪青6266f992017-05-15 21:21:03 +080092<p>To support these capabilities, Tomcat includes a web application
Hongqing Liufd5ee812014-05-10 16:32:51 +080093(installed by default on context path <code>/manager</code>) that supports
94the following functions:</p>
95<ul>
96<li>Deploy a new web application from the uploaded contents of a WAR file.</li>
97<li>Deploy a new web application, on a specified context path, from the
98 server file system.</li>
99<li>List the currently deployed web applications, as well as the
100 sessions that are currently active for those web apps.</li>
101<li>Reload an existing web application, to reflect changes in the
102 contents of <code>/WEB-INF/classes</code> or <code>/WEB-INF/lib</code>.
103 </li>
104<li>List the OS and JVM property values.</li>
105<li>List the available global JNDI resources, for use in deployment
106 tools that are preparing <code>&lt;ResourceLink&gt;</code> elements
107 nested in a <code>&lt;Context&gt;</code> deployment description.</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800108<li>Start a stopped application (thus making it available again).</li>
109<li>Stop an existing application (so that it becomes unavailable), but
110 do not undeploy it.</li>
111<li>Undeploy a deployed web application and delete its document base
112 directory (unless it was deployed from file system).</li>
113</ul>
114
刘洪青6266f992017-05-15 21:21:03 +0800115<p>A default Tomcat installation includes the Manager. To add an instance of the
Hongqing Liufd5ee812014-05-10 16:32:51 +0800116Manager web application <code>Context</code> to a new host install the
117<code>manager.xml</code> context configuration file in the
118<code>$CATALINA_BASE/conf/[enginename]/[hostname]</code> folder. Here is an
119example:</p>
刘洪青6266f992017-05-15 21:21:03 +0800120<div class="codeBox"><pre><code>&lt;Context privileged="true" antiResourceLocking="false"
121 docBase="${catalina.home}/webapps/manager"&gt;
Hongqing Liufd5ee812014-05-10 16:32:51 +0800122 &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
刘洪青6266f992017-05-15 21:21:03 +0800123 allow="127\.0\.0\.1" /&gt;
124&lt;/Context&gt;</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800125
126<p>If you have Tomcat configured to support multiple virtual hosts
127(websites) you would need to configure a Manager for each.</p>
128
129<p>There are three ways to use the <strong>Manager</strong> web application.</p>
130<ul>
131<li>As an application with a user interface you use in your browser.
132Here is an example URL where you can replace <code>localhost</code> with
刘洪青6266f992017-05-15 21:21:03 +0800133your website host name: <code>http://localhost:8080/manager/html</code> .</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800134<li>A minimal version using HTTP requests only which is suitable for use
135by scripts setup by system administrators. Commands are given as part of the
136request URI, and responses are in the form of simple text that can be easily
刘洪青6266f992017-05-15 21:21:03 +0800137parsed and processed. See <a href="#Supported_Manager_Commands">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800138Supported Manager Commands</a> for more information.</li>
139<li>A convenient set of task definitions for the <em>Ant</em>
140(version 1.4 or later) build tool. See
刘洪青6266f992017-05-15 21:21:03 +0800141<a href="#Executing_Manager_Commands_With_Ant">Executing Manager Commands
Hongqing Liufd5ee812014-05-10 16:32:51 +0800142With Ant</a> for more information.</li>
143</ul>
144
145</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Configuring Manager Application Access"><!--()--></a><a name="Configuring_Manager_Application_Access"><strong>Configuring Manager Application Access</strong></a></font></td></tr><tr><td><blockquote>
146
刘洪青6266f992017-05-15 21:21:03 +0800147
Hongqing Liufd5ee812014-05-10 16:32:51 +0800148 <p><em>The description below uses the variable name $CATALINA_BASE to refer the
149 base directory against which most relative paths are resolved. If you have
刘洪青6266f992017-05-15 21:21:03 +0800150 not configured Tomcat for multiple instances by setting a CATALINA_BASE
Hongqing Liufd5ee812014-05-10 16:32:51 +0800151 directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
刘洪青6266f992017-05-15 21:21:03 +0800152 the directory into which you have installed Tomcat.</em></p>
153
Hongqing Liufd5ee812014-05-10 16:32:51 +0800154
155<p>It would be quite unsafe to ship Tomcat with default settings that allowed
156anyone on the Internet to execute the Manager application on your server.
157Therefore, the Manager application is shipped with the requirement that anyone
158who attempts to use it must authenticate themselves, using a username and
刘洪青6266f992017-05-15 21:21:03 +0800159password that have one of <strong>manager-xxx</strong> roles associated with
160them (the role name depends on what functionality is required).
Hongqing Liufd5ee812014-05-10 16:32:51 +0800161Further, there is no username in the default users file
刘洪青6266f992017-05-15 21:21:03 +0800162(<code>$CATALINA_BASE/conf/tomcat-users.xml</code>) that is assigned to those
163roles. Therefore, access to the Manager application is completely disabled
164by default.</p>
165
166<p>You can find the role names in the <code>web.xml</code> file of the Manager
167web application. The available roles are:</p>
168
169<ul>
170 <li><strong>manager-gui</strong> &mdash; Access to the HTML interface.</li>
171 <li><strong>manager-status</strong> &mdash; Access to the "Server Status"
172 page only.</li>
173 <li><strong>manager-script</strong> &mdash; Access to the tools-friendly
174 plain text interface that is described in this document,
175 and to the "Server Status" page.</li>
176 <li><strong>manager-jmx</strong> &mdash; Access to JMX proxy interface
177 and to the "Server Status" page.</li>
178</ul>
179
180<p>The HTML interface is protected against CSRF (Cross-Site Request Forgery)
181attacks, but the text and JMX interfaces cannot be protected. It means that
182users who are allowed access to the text and JMX interfaces have to be cautious
183when accessing the Manager application with a web browser.
184To maintain the CSRF protection:</p>
185
186<ul>
187 <li>If you use web browser to access the Manager application using
188 a user that has either <strong>manager-script</strong> or
189 <strong>manager-jmx</strong> roles (for example for testing
190 the plain text or JMX interfaces), you MUST close all windows
191 of the browser afterwards to terminate the session.
192 If you do not close the browser and visit other sites, you may become
193 victim of a CSRF attack.</li>
194 <li>It is recommended to never grant
195 the <strong>manager-script</strong> or <strong>manager-jmx</strong>
196 roles to users that have the <strong>manager-gui</strong> role.</li>
197</ul>
198
199<p><strong>Note</strong> that JMX proxy interface is effectively low-level root-like
200administrative interface of Tomcat. One can do a lot, if he knows
201what commands to call. You should be cautious when enabling the
202<strong>manager-jmx</strong> role.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800203
204<p>To enable access to the Manager web application, you must either create
刘洪青6266f992017-05-15 21:21:03 +0800205a new username/password combination and associate one of the
206<strong>manager-xxx</strong> roles with it, or add a
207<strong>manager-xxx</strong> role
208to some existing username/password combination.
209As the majority of this document describes the using the text interface, this
210example will use the role name <strong>manager-script</strong>.
211Exactly how the usernames/passwords are configured depends on which
212<a href="config/realm.html">Realm implementation</a> you are using:</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800213<ul>
刘洪青6266f992017-05-15 21:21:03 +0800214<li><em>UserDatabaseRealm</em> plus <em>MemoryUserDatabase</em>, or <em>MemoryRealm</em>
215 &mdash; The <em>UserDatabaseRealm</em> and <em>MemoryUserDatabase</em> are
216 configured in the default <code>$CATALINA_BASE/conf/server.xml</code>.
217 Both <em>MemoryUserDatabase</em> and <em>MemoryRealm</em> read an
218 XML-format file by default stored at
Hongqing Liufd5ee812014-05-10 16:32:51 +0800219 <code>$CATALINA_BASE/conf/tomcat-users.xml</code>, which can be
220 edited with any text editor. This file contains an XML
221 <code>&lt;user&gt;</code> for each individual user, which might
222 look something like this:
刘洪青6266f992017-05-15 21:21:03 +0800223<div class="codeBox"><pre><code>&lt;user username="craigmcc" password="secret" roles="standard,manager-script" /&gt;</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800224 which defines the username and password used by this individual to
225 log on, and the role names he or she is associated with. You can
刘洪青6266f992017-05-15 21:21:03 +0800226 add the <strong>manager-script</strong> role to the comma-delimited
Hongqing Liufd5ee812014-05-10 16:32:51 +0800227 <code>roles</code> attribute for one or more existing users, and/or
228 create new users with that assigned role.</li>
刘洪青6266f992017-05-15 21:21:03 +0800229<li><em>DataSourceRealm</em> or <em>JDBCRealm</em>
230 &mdash; Your user and role information is stored in
231 a database accessed via JDBC. Add the <strong>manager-script</strong> role
232 to one or more existing users, and/or create one or more new users
233 with this role assigned, following the standard procedures for your
Hongqing Liufd5ee812014-05-10 16:32:51 +0800234 environment.</li>
刘洪青6266f992017-05-15 21:21:03 +0800235<li><em>JNDIRealm</em> &mdash; Your user and role information is stored in
236 a directory server accessed via LDAP. Add the
237 <strong>manager-script</strong> role to one or more existing users,
238 and/or create one or more new users with this role assigned, following
239 the standard procedures for your environment.</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800240</ul>
241
242<p>The first time you attempt to issue one of the Manager commands
243described in the next section, you will be challenged to log on using
244BASIC authentication. The username and password you enter do not matter,
245as long as they identify a valid user in the users database who possesses
刘洪青6266f992017-05-15 21:21:03 +0800246the role <strong>manager-script</strong>.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800247
刘洪青6266f992017-05-15 21:21:03 +0800248<p>In addition to the password restrictions, access to the Manager web
249application can be restricted by the <strong>remote IP address</strong> or host
250by adding a <code>RemoteAddrValve</code> or <code>RemoteHostValve</code>.
251See <a href="config/valve.html#Remote_Address_Filter">valves documentation</a>
252for details. Here is
Hongqing Liufd5ee812014-05-10 16:32:51 +0800253an example of restricting access to the localhost by IP address:</p>
刘洪青6266f992017-05-15 21:21:03 +0800254<div class="codeBox"><pre><code>&lt;Context privileged="true"&gt;
255 &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
256 allow="127\.0\.0\.1"/&gt;
257&lt;/Context&gt;</code></pre></div>
258
259</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="HTML User-friendly Interface"><!--()--></a><a name="HTML_User-friendly_Interface"><strong>HTML User-friendly Interface</strong></a></font></td></tr><tr><td><blockquote>
260
261<p>The user-friendly HTML interface of Manager web application is located at</p>
262
263<div class="codeBox"><pre><code>http://{host}:{port}/manager/html</code></pre></div>
264
265<p>As has already been mentioned above, you need <strong>manager-gui</strong>
266role to be allowed to access it. There is a separate document that provides
267help on this interface. See:</p>
268
269<ul>
270 <li><a href="html-manager-howto.html">HTML Manager documentation</a></li>
271</ul>
272
273<p>The HTML interface is protected against CSRF (Cross-Site Request Forgery)
274attacks. Each access to the HTML pages generates a random token, which is
275stored in your session and is included in all links on the page. If your next
276action does not have correct value of the token, the action will be denied.
277If the token has expired you can start again from the main page or
278<em>List Applications</em> page of Manager.</p>
279
Hongqing Liufd5ee812014-05-10 16:32:51 +0800280</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Supported Manager Commands"><!--()--></a><a name="Supported_Manager_Commands"><strong>Supported Manager Commands</strong></a></font></td></tr><tr><td><blockquote>
281
282<p>All commands that the Manager application knows how to process are
283specified in a single request URI like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800284<div class="codeBox"><pre><code>http://{host}:{port}/manager/text/{command}?{parameters}</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800285<p>where <code>{host}</code> and <code>{port}</code> represent the hostname
286and port number on which Tomcat is running, <code>{command}</code>
287represents the Manager command you wish to execute, and
288<code>{parameters}</code> represents the query parameters
289that are specific to that command. In the illustrations below, customize
290the host and port appropriately for your installation.</p>
291
刘洪青6266f992017-05-15 21:21:03 +0800292<p>The commands are usually executed by HTTP GET requests. The
293<code>/deploy</code> command has a form that is executed by an HTTP PUT request.</p>
294
295<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Common Parameters"><!--()--></a><a name="Common_Parameters"><strong>Common Parameters</strong></a></font></td></tr><tr><td><blockquote>
296
Hongqing Liufd5ee812014-05-10 16:32:51 +0800297<p>Most commands accept one or more of the following query parameters:</p>
298<ul>
299<li><strong>path</strong> - The context path (including the leading slash)
300 of the web application you are dealing with. To select the ROOT web
刘洪青6266f992017-05-15 21:21:03 +0800301 application, specify "/". <strong>NOTE</strong>:
Hongqing Liufd5ee812014-05-10 16:32:51 +0800302 It is not possible to perform administrative commands on the
303 Manager application itself.</li>
刘洪青6266f992017-05-15 21:21:03 +0800304<li><strong>version</strong> - The version of this web application as used by
305 the <a href="config/context.html">parallel deployment</a> feature. If you
306 use parallel deployment wherever a path is required you must specify a
307 version in addition to the path and it is the combination of path and
308 version that must be unique rather than just the path.</li>
309<li><strong>war</strong> - URL of a web application archive (WAR) file, or
Hongqing Liufd5ee812014-05-10 16:32:51 +0800310 pathname of a directory which contains the web application, or a
311 Context configuration ".xml" file. You can use URLs in any of the
312 following formats:
313 <ul>
314 <li><strong>file:/absolute/path/to/a/directory</strong> - The absolute
315 path of a directory that contains the unpacked version of a web
316 application. This directory will be attached to the context path
317 you specify without any changes.</li>
318 <li><strong>file:/absolute/path/to/a/webapp.war</strong> - The absolute
319 path of a web application archive (WAR) file. This is valid
320 <strong>only</strong> for the <code>/deploy</code> command, and is
321 the only acceptable format to that command.</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800322 <li><strong>file:/absolute/path/to/a/context.xml</strong> - The
323 absolute path of a web application Context configuration ".xml"
324 file which contains the Context configuration element.</li>
325 <li><strong>directory</strong> - The directory name for the web
326 application context in the Host's application base directory.</li>
327 <li><strong>webapp.war</strong> - The name of a web application war file
328 located in the Host's application base directory.</li>
329 </ul></li>
330</ul>
331
332<p>Each command will return a response in <code>text/plain</code> format
333(i.e. plain ASCII with no HTML markup), making it easy for both humans and
334programs to read). The first line of the response will begin with either
335<code>OK</code> or <code>FAIL</code>, indicating whether the requested
336command was successful or not. In the case of failure, the rest of the first
337line will contain a description of the problem that was encountered. Some
338commands include additional lines of information as described below.</p>
339
340<p><em>Internationalization Note</em> - The Manager application looks up
341its message strings in resource bundles, so it is possible that the strings
342have been translated for your platform. The examples below show the English
343version of the messages.</p>
344
刘洪青6266f992017-05-15 21:21:03 +0800345</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800346
刘洪青6266f992017-05-15 21:21:03 +0800347<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy A New Application Archive (WAR) Remotely"><!--()--></a><a name="Deploy_A_New_Application_Archive_(WAR)_Remotely"><strong>Deploy A New Application Archive (WAR) Remotely</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800348
刘洪青6266f992017-05-15 21:21:03 +0800349<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?path=/foo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800350
351<p>Upload the web application archive (WAR) file that is specified as the
352request data in this HTTP PUT request, install it into the <code>appBase</code>
刘洪青6266f992017-05-15 21:21:03 +0800353directory of our corresponding virtual host, and start, deriving the name for
354the WAR file added to the <code>appBase</code> from the specified path. The
355application can later be undeployed (and the corresponding WAR file removed) by
356use of the <code>/undeploy</code> command.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800357
刘洪青6266f992017-05-15 21:21:03 +0800358<p>This command is executed by an HTTP PUT request.</p>
359
360<p>The .WAR file may include Tomcat specific deployment configuration, by
361including a Context configuration XML file in
Hongqing Liufd5ee812014-05-10 16:32:51 +0800362<code>/META-INF/context.xml</code>.</p>
363
364<p>URL parameters include:</p>
365<ul>
366<li><code>update</code>: When set to true, any existing update will be
367 undeployed first. The default value is set to false.</li>
368<li><code>tag</code>: Specifying a tag name, this allows associating the
刘洪青6266f992017-05-15 21:21:03 +0800369 deployed webapp with a tag or label. If the web application is undeployed,
370 it can be later redeployed when needed using only the tag.</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800371</ul>
372
373<p><strong>NOTE</strong> - This command is the logical
374opposite of the <code>/undeploy</code> command.</p>
375
376<p>If installation and startup is successful, you will receive a response
377like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800378<div class="codeBox"><pre><code>OK - Deployed application at context path /foo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800379
380<p>Otherwise, the response will start with <code>FAIL</code> and include an
381error message. Possible causes for problems include:</p>
382<ul>
383<li><em>Application already exists at path /foo</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800384 <p>The context paths for all currently running web applications must be
385 unique. Therefore, you must undeploy the existing web
386 application using this context path, or choose a different context path
387 for the new one. The <code>update</code> parameter may be specified as
388 a parameter on the URL, with a value of <code>true</code> to avoid this
389 error. In that case, an undeploy will be performed on an existing
390 application before performing the deployment.</p>
刘洪青6266f992017-05-15 21:21:03 +0800391 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800392<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800393 <p>An exception was encountered trying to start the new web application.
刘洪青6266f992017-05-15 21:21:03 +0800394 Check the Tomcat logs for the details, but likely explanations include
Hongqing Liufd5ee812014-05-10 16:32:51 +0800395 problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
396 classes encountered when initializing application event listeners and
397 filters.</p>
刘洪青6266f992017-05-15 21:21:03 +0800398 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800399</ul>
400
401</blockquote></td></tr></table>
402
403<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy A New Application from a Local Path"><!--()--></a><a name="Deploy_A_New_Application_from_a_Local_Path"><strong>Deploy A New Application from a Local Path</strong></a></font></td></tr><tr><td><blockquote>
404
405<p>Deploy and start a new web application, attached to the specified context
406<code>path</code> (which must not be in use by any other web application).
407This command is the logical opposite of the <code>/undeploy</code> command.</p>
408
刘洪青6266f992017-05-15 21:21:03 +0800409<p>This command is executed by an HTTP GET request.
410There are a number of different ways the deploy command can be used.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800411
刘洪青6266f992017-05-15 21:21:03 +0800412<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy a previously deployed webapp"><!--()--></a><a name="Deploy_a_previously_deployed_webapp"><strong>Deploy a previously deployed webapp</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800413
刘洪青6266f992017-05-15 21:21:03 +0800414<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?path=/footoo&amp;tag=footag</code></pre></div>
415
416<p>This can be used to deploy a previously deployed web application, which
Hongqing Liufd5ee812014-05-10 16:32:51 +0800417has been deployed using the <code>tag</code> attribute. Note that the work
刘洪青6266f992017-05-15 21:21:03 +0800418directory of the Manager webapp will contain the previously deployed WARs;
Hongqing Liufd5ee812014-05-10 16:32:51 +0800419removing it would make the deployment fail.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800420
刘洪青6266f992017-05-15 21:21:03 +0800421</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800422
刘洪青6266f992017-05-15 21:21:03 +0800423<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy a Directory or WAR by URL"><!--()--></a><a name="Deploy_a_Directory_or_WAR_by_URL"><strong>Deploy a Directory or WAR by URL</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800424
425<p>Deploy a web application directory or ".war" file located on the Tomcat
刘洪青6266f992017-05-15 21:21:03 +0800426server. If no <code>path</code> is specified, the path and version are derived
427from the directory name or the war file name. The <code>war</code> parameter
428specifies a URL (including the <code>file:</code> scheme) for either
Hongqing Liufd5ee812014-05-10 16:32:51 +0800429a directory or a web application archive (WAR) file. The supported syntax for
430a URL referring to a WAR file is described on the Javadocs page for the
431<code>java.net.JarURLConnection</code> class. Use only URLs that refer to
432the entire WAR file.</p>
433
434<p>In this example the web application located in the directory
435<code>/path/to/foo</code> on the Tomcat server is deployed as the
436web application context named <code>/footoo</code>.</p>
刘洪青6266f992017-05-15 21:21:03 +0800437<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?path=/footoo&amp;war=file:/path/to/foo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800438
439
440<p>In this example the ".war" file <code>/path/to/bar.war</code> on the
441Tomcat server is deployed as the web application context named
442<code>/bar</code>. Notice that there is no <code>path</code> parameter
443so the context path defaults to the name of the web application archive
444file without the ".war" extension.</p>
刘洪青6266f992017-05-15 21:21:03 +0800445<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?war=file:/path/to/bar.war</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800446
刘洪青6266f992017-05-15 21:21:03 +0800447</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800448
刘洪青6266f992017-05-15 21:21:03 +0800449<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy a Directory or War from the Host appBase"><!--()--></a><a name="Deploy_a_Directory_or_War_from_the_Host_appBase"><strong>Deploy a Directory or War from the Host appBase</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800450
451<p>Deploy a web application directory or ".war" file located in your Host
刘洪青6266f992017-05-15 21:21:03 +0800452appBase directory. The path and optional version are derived from the directory
453or war file name.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800454
455<p>In this example the web application located in a sub directory named
456<code>foo</code> in the Host appBase directory of the Tomcat server is
457deployed as the web application context named <code>/foo</code>. Notice
458that the context path used is the name of the web application directory.</p>
刘洪青6266f992017-05-15 21:21:03 +0800459<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?war=foo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800460
461
462<p>In this example the ".war" file <code>bar.war</code> located in your
463Host appBase directory on the Tomcat server is deployed as the web
464application context named <code>/bar</code>.</p>
刘洪青6266f992017-05-15 21:21:03 +0800465<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?war=bar.war</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800466
刘洪青6266f992017-05-15 21:21:03 +0800467</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800468
刘洪青6266f992017-05-15 21:21:03 +0800469<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy using a Context configuration %22.xml%22 file"><!--()--></a><a name="Deploy_using_a_Context_configuration_%22.xml%22_file"><strong>Deploy using a Context configuration ".xml" file</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800470
471<p>If the Host deployXML flag is set to true you can deploy a web
472application using a Context configuration ".xml" file and an optional
473".war" file or web application directory. The context <code>path</code>
474is not used when deploying a web application using a context ".xml"
475configuration file.</p>
476
477<p>A Context configuration ".xml" file can contain valid XML for a
478web application Context just as if it were configured in your
479Tomcat <code>server.xml</code> configuration file. Here is an
480example:</p>
刘洪青6266f992017-05-15 21:21:03 +0800481<div class="codeBox"><pre><code>&lt;Context path="/foobar" docBase="/path/to/application/foobar"&gt;
482&lt;/Context&gt;</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800483
484
485<p>When the optional <code>war</code> parameter is set to the URL
486for a web application ".war" file or directory it overrides any
487docBase configured in the context configuration ".xml" file.</p>
488
489<p>Here is an example of deploying an application using a Context
490configuration ".xml" file.</p>
刘洪青6266f992017-05-15 21:21:03 +0800491<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy?config=file:/path/context.xml</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800492
493
494<p>Here is an example of deploying an application using a Context
495configuration ".xml" file and a web application ".war" file located
496on the server.</p>
刘洪青6266f992017-05-15 21:21:03 +0800497<div class="codeBox"><pre><code>http://localhost:8080/manager/text/deploy
498 ?config=file:/path/context.xml&amp;war=file:/path/bar.war</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800499
刘洪青6266f992017-05-15 21:21:03 +0800500</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800501
刘洪青6266f992017-05-15 21:21:03 +0800502<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deployment Notes"><!--()--></a><a name="Deployment_Notes"><strong>Deployment Notes</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800503
504<p>If the Host is configured with unpackWARs=true and you deploy a war
505file, the war will be unpacked into a directory in your Host appBase
506directory.</p>
507
508<p>If the application war or directory is installed in your Host appBase
刘洪青6266f992017-05-15 21:21:03 +0800509directory and either the Host is configured with autoDeploy=true or the
510Context path must match the directory name or war file name without the
511".war" extension.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800512
513<p>For security when untrusted users can manage web applications, the
514Host deployXML flag can be set to false. This prevents untrusted users
515from deploying web applications using a configuration XML file and
516also prevents them from deploying application directories or ".war"
517files located outside of their Host appBase.</p>
518
刘洪青6266f992017-05-15 21:21:03 +0800519</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800520
刘洪青6266f992017-05-15 21:21:03 +0800521<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy Response"><!--()--></a><a name="Deploy_Response"><strong>Deploy Response</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800522
523<p>If installation and startup is successful, you will receive a response
524like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800525<div class="codeBox"><pre><code>OK - Deployed application at context path /foo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800526
527<p>Otherwise, the response will start with <code>FAIL</code> and include an
528error message. Possible causes for problems include:</p>
529<ul>
530<li><em>Application already exists at path /foo</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800531 <p>The context paths for all currently running web applications must be
532 unique. Therefore, you must undeploy the existing web
533 application using this context path, or choose a different context path
534 for the new one. The <code>update</code> parameter may be specified as
535 a parameter on the URL, with a value of <code>true</code> to avoid this
536 error. In that case, an undeploy will be performed on an existing
537 application before performing the deployment.</p>
刘洪青6266f992017-05-15 21:21:03 +0800538 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800539<li><em>Document base does not exist or is not a readable directory</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800540 <p>The URL specified by the <code>war</code> parameter must identify a
541 directory on this server that contains the "unpacked" version of a
542 web application, or the absolute URL of a web application archive (WAR)
543 file that contains this application. Correct the value specified by
544 the <code>war</code> parameter.</p>
刘洪青6266f992017-05-15 21:21:03 +0800545 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800546<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800547 <p>An exception was encountered trying to start the new web application.
刘洪青6266f992017-05-15 21:21:03 +0800548 Check the Tomcat logs for the details, but likely explanations include
Hongqing Liufd5ee812014-05-10 16:32:51 +0800549 problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
550 classes encountered when initializing application event listeners and
551 filters.</p>
刘洪青6266f992017-05-15 21:21:03 +0800552 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800553<li><em>Invalid application URL was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800554 <p>The URL for the directory or web application that you specified
555 was not valid. Such URLs must start with <code>file:</code>, and URLs
556 for a WAR file must end in ".war".</p>
刘洪青6266f992017-05-15 21:21:03 +0800557 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800558<li><em>Invalid context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800559 <p>The context path must start with a slash character. To reference the
560 ROOT web application use "/".</p>
刘洪青6266f992017-05-15 21:21:03 +0800561 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800562<li><em>Context path must match the directory or WAR file name:</em>
刘洪青6266f992017-05-15 21:21:03 +0800563 <p>If the application war or directory is installed in your Host appBase
564 directory and either the Host is configured with autoDeploy=true the
565 Context path must match the directory name or war file name without
566 the ".war" extension.</p>
567 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800568<li><em>Only web applications in the Host web application directory can
569 be installed</em>
刘洪青6266f992017-05-15 21:21:03 +0800570 <p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800571 If the Host deployXML flag is set to false this error will happen
572 if an attempt is made to deploy a web application directory or
573 ".war" file outside of the Host appBase directory.
刘洪青6266f992017-05-15 21:21:03 +0800574 </p></li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800575</ul>
576
577</blockquote></td></tr></table>
刘洪青6266f992017-05-15 21:21:03 +0800578</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800579
580<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="List Currently Deployed Applications"><!--()--></a><a name="List_Currently_Deployed_Applications"><strong>List Currently Deployed Applications</strong></a></font></td></tr><tr><td><blockquote>
581
刘洪青6266f992017-05-15 21:21:03 +0800582<div class="codeBox"><pre><code>http://localhost:8080/manager/text/list</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800583
584<p>List the context paths, current status (<code>running</code> or
585<code>stopped</code>), and number of active sessions for all currently
586deployed web applications. A typical response immediately
587after starting Tomcat might look like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800588<div class="codeBox"><pre><code>OK - Listed applications for virtual host localhost
589/webdav:running:0:webdav
590/examples:running:0:examples
591/manager:running:0:manager
592/:running:0:ROOT
593/test:running:0:test##2
594/test:running:0:test##1</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800595
596</blockquote></td></tr></table>
597
598<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Reload An Existing Application"><!--()--></a><a name="Reload_An_Existing_Application"><strong>Reload An Existing Application</strong></a></font></td></tr><tr><td><blockquote>
599
刘洪青6266f992017-05-15 21:21:03 +0800600<div class="codeBox"><pre><code>http://localhost:8080/manager/text/reload?path=/examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800601
602<p>Signal an existing application to shut itself down and reload. This can
603be useful when the web application context is not reloadable and you have
604updated classes or property files in the <code>/WEB-INF/classes</code>
605directory or when you have added or updated jar files in the
606<code>/WEB-INF/lib</code> directory.
607</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800608
609<p>If this command succeeds, you will see a response like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800610<div class="codeBox"><pre><code>OK - Reloaded application at context path /examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800611
612<p>Otherwise, the response will start with <code>FAIL</code> and include an
613error message. Possible causes for problems include:</p>
614<ul>
615<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800616 <p>An exception was encountered trying to restart the web application.
刘洪青6266f992017-05-15 21:21:03 +0800617 Check the Tomcat logs for the details.</p>
618 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800619<li><em>Invalid context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800620 <p>The context path must start with a slash character. To reference the
621 ROOT web application use "/".</p>
刘洪青6266f992017-05-15 21:21:03 +0800622 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800623<li><em>No context exists for path /foo</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800624 <p>There is no deployed application on the context path
625 that you specified.</p>
刘洪青6266f992017-05-15 21:21:03 +0800626 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800627<li><em>No context path was specified</em>
刘洪青6266f992017-05-15 21:21:03 +0800628 <p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800629 The <code>path</code> parameter is required.
刘洪青6266f992017-05-15 21:21:03 +0800630 </p></li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800631<li><em>Reload not supported on WAR deployed at path /foo</em>
刘洪青6266f992017-05-15 21:21:03 +0800632 <p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800633 Currently, application reloading (to pick up changes to the classes or
634 <code>web.xml</code> file) is not supported when a web application is
635 deployed directly from a WAR file. It only works when the web application
636 is deployed from an unpacked directory. If you are using a WAR file,
637 you should <code>undeploy</code> and then <code>deploy</code> or
638 <code>deploy</code> with the <code>update</code> parameter the
639 application again to pick up your changes.
刘洪青6266f992017-05-15 21:21:03 +0800640 </p></li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800641</ul>
642
643</blockquote></td></tr></table>
644
645<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="List OS and JVM Properties"><!--()--></a><a name="List_OS_and_JVM_Properties"><strong>List OS and JVM Properties</strong></a></font></td></tr><tr><td><blockquote>
646
刘洪青6266f992017-05-15 21:21:03 +0800647<div class="codeBox"><pre><code>http://localhost:8080/manager/text/serverinfo</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800648
649<p>Lists information about the Tomcat version, OS, and JVM properties.</p>
650
651<p>If an error occurs, the response will start with <code>FAIL</code> and
652include an error message. Possible causes for problems include:</p>
653<ul>
654<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800655 <p>An exception was encountered trying to enumerate the system properties.
刘洪青6266f992017-05-15 21:21:03 +0800656 Check the Tomcat logs for the details.</p>
657 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800658</ul>
659
660</blockquote></td></tr></table>
661
662<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="List Available Global JNDI Resources"><!--()--></a><a name="List_Available_Global_JNDI_Resources"><strong>List Available Global JNDI Resources</strong></a></font></td></tr><tr><td><blockquote>
663
刘洪青6266f992017-05-15 21:21:03 +0800664<div class="codeBox"><pre><code>http://localhost:8080/manager/text/resources[?type=xxxxx]</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800665
666<p>List the global JNDI resources that are available for use in resource
667links for context configuration files. If you specify the <code>type</code>
668request parameter, the value must be the fully qualified Java class name of
669the resource type you are interested in (for example, you would specify
670<code>javax.sql.DataSource</code> to acquire the names of all available
671JDBC data sources). If you do not specify the <code>type</code> request
672parameter, resources of all types will be returned.</p>
673
674<p>Depending on whether the <code>type</code> request parameter is specified
675or not, the first line of a normal response will be:</p>
刘洪青6266f992017-05-15 21:21:03 +0800676<div class="codeBox"><pre><code>OK - Listed global resources of all types</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800677<p>or</p>
刘洪青6266f992017-05-15 21:21:03 +0800678<div class="codeBox"><pre><code>OK - Listed global resources of type xxxxx</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800679<p>followed by one line for each resource. Each line is composed of fields
680delimited by colon characters (":"), as follows:</p>
681<ul>
682<li><em>Global Resource Name</em> - The name of this global JNDI resource,
683 which would be used in the <code>global</code> attribute of a
684 <code>&lt;ResourceLink&gt;</code> element.</li>
685<li><em>Global Resource Type</em> - The fully qualified Java class name of
686 this global JNDI resource.</li>
687</ul>
688
689<p>If an error occurs, the response will start with <code>FAIL</code> and
690include an error message. Possible causes for problems include:</p>
691<ul>
692<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800693 <p>An exception was encountered trying to enumerate the global JNDI
刘洪青6266f992017-05-15 21:21:03 +0800694 resources. Check the Tomcat logs for the details.</p>
695 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800696<li><em>No global JNDI resources are available</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800697 <p>The Tomcat server you are running has been configured without
698 global JNDI resources.</p>
刘洪青6266f992017-05-15 21:21:03 +0800699 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800700</ul>
701
702
703</blockquote></td></tr></table>
704
Hongqing Liufd5ee812014-05-10 16:32:51 +0800705<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Session Statistics"><!--()--></a><a name="Session_Statistics"><strong>Session Statistics</strong></a></font></td></tr><tr><td><blockquote>
706
刘洪青6266f992017-05-15 21:21:03 +0800707<div class="codeBox"><pre><code>http://localhost:8080/manager/text/sessions?path=/examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800708
709<p>Display the default session timeout for a web application, and the
刘洪青6266f992017-05-15 21:21:03 +0800710number of currently active sessions that fall within one-minute ranges of
Hongqing Liufd5ee812014-05-10 16:32:51 +0800711their actual timeout times. For example, after restarting Tomcat and then
712executing one of the JSP samples in the <code>/examples</code> web app,
713you might get something like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800714
715<div class="codeBox"><pre><code>OK - Session information for application at context path /examples
Hongqing Liufd5ee812014-05-10 16:32:51 +0800716Default maximum session inactive interval 30 minutes
刘洪青6266f992017-05-15 21:21:03 +0800717&lt;1 minutes: 1 sessions
7181 - &lt;2 minutes: 1 sessions</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800719
720</blockquote></td></tr></table>
721
刘洪青6266f992017-05-15 21:21:03 +0800722<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Expire Sessions"><!--()--></a><a name="Expire_Sessions"><strong>Expire Sessions</strong></a></font></td></tr><tr><td><blockquote>
723
724<div class="codeBox"><pre><code>http://localhost:8080/manager/text/expire?path=/examples&amp;idle=num</code></pre></div>
725
726<p>Display the session statistics (like the above <code>/sessions</code>
727command) and expire sessions that are idle for longer than <code>num</code>
728minutes. To expire all sessions, use <code>&amp;idle=0</code> .</p>
729
730<div class="codeBox"><pre><code>OK - Session information for application at context path /examples
731Default maximum session inactive interval 30 minutes
7321 - &lt;2 minutes: 1 sessions
7333 - &lt;4 minutes: 1 sessions
734&gt;0 minutes: 2 sessions were expired</code></pre></div>
735
736<p>Actually <code>/sessions</code> and <code>/expire</code> are synonyms for
737the same command. The difference is in the presence of <code>idle</code>
738parameter.</p>
739
740</blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800741
742<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Start an Existing Application"><!--()--></a><a name="Start_an_Existing_Application"><strong>Start an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
743
刘洪青6266f992017-05-15 21:21:03 +0800744<div class="codeBox"><pre><code>http://localhost:8080/manager/text/start?path=/examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800745
746<p>Signal a stopped application to restart, and make itself available again.
747Stopping and starting is useful, for example, if the database required by
748your application becomes temporarily unavailable. It is usually better to
749stop the web application that relies on this database rather than letting
750users continuously encounter database exceptions.</p>
751
752<p>If this command succeeds, you will see a response like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800753<div class="codeBox"><pre><code>OK - Started application at context path /examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800754
755<p>Otherwise, the response will start with <code>FAIL</code> and include an
756error message. Possible causes for problems include:</p>
757<ul>
758<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800759 <p>An exception was encountered trying to start the web application.
刘洪青6266f992017-05-15 21:21:03 +0800760 Check the Tomcat logs for the details.</p>
761 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800762<li><em>Invalid context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800763 <p>The context path must start with a slash character. To reference the
764 ROOT web application use "/".</p>
刘洪青6266f992017-05-15 21:21:03 +0800765 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800766<li><em>No context exists for path /foo</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800767 <p>There is no deployed application on the context path
768 that you specified.</p>
刘洪青6266f992017-05-15 21:21:03 +0800769 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800770<li><em>No context path was specified</em>
刘洪青6266f992017-05-15 21:21:03 +0800771 <p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800772 The <code>path</code> parameter is required.
刘洪青6266f992017-05-15 21:21:03 +0800773 </p></li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800774</ul>
775
776</blockquote></td></tr></table>
777
778<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Stop an Existing Application"><!--()--></a><a name="Stop_an_Existing_Application"><strong>Stop an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
779
刘洪青6266f992017-05-15 21:21:03 +0800780<div class="codeBox"><pre><code>http://localhost:8080/manager/text/stop?path=/examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800781
782<p>Signal an existing application to make itself unavailable, but leave it
783deployed. Any request that comes in while an application is
784stopped will see an HTTP error 404, and this application will show as
785"stopped" on a list applications command.</p>
786
787<p>If this command succeeds, you will see a response like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800788<div class="codeBox"><pre><code>OK - Stopped application at context path /examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800789
790<p>Otherwise, the response will start with <code>FAIL</code> and include an
791error message. Possible causes for problems include:</p>
792<ul>
793<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800794 <p>An exception was encountered trying to stop the web application.
刘洪青6266f992017-05-15 21:21:03 +0800795 Check the Tomcat logs for the details.</p>
796 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800797<li><em>Invalid context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800798 <p>The context path must start with a slash character. To reference the
799 ROOT web application use "/".</p>
刘洪青6266f992017-05-15 21:21:03 +0800800 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800801<li><em>No context exists for path /foo</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800802 <p>There is no deployed application on the context path
803 that you specified.</p>
刘洪青6266f992017-05-15 21:21:03 +0800804 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800805<li><em>No context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800806 The <code>path</code> parameter is required.
刘洪青6266f992017-05-15 21:21:03 +0800807 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800808</ul>
809
810</blockquote></td></tr></table>
811
812
813<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Undeploy an Existing Application"><!--()--></a><a name="Undeploy_an_Existing_Application"><strong>Undeploy an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
814
刘洪青6266f992017-05-15 21:21:03 +0800815<div class="codeBox"><pre><code>http://localhost:8080/manager/text/undeploy?path=/examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800816
刘洪青6266f992017-05-15 21:21:03 +0800817<p><strong><span style="color: red;">WARNING</span> - This command will delete any web
818application artifacts that exist within <code>appBase</code> directory
Hongqing Liufd5ee812014-05-10 16:32:51 +0800819(typically "webapps") for this virtual host</strong>.
刘洪青6266f992017-05-15 21:21:03 +0800820This will delete the application .WAR, if present,
821the application directory resulting either from a deploy in unpacked form
Hongqing Liufd5ee812014-05-10 16:32:51 +0800822or from .WAR expansion as well as the XML Context definition from
刘洪青6266f992017-05-15 21:21:03 +0800823<code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> directory.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800824If you simply want to take an application
825out of service, you should use the <code>/stop</code> command instead.</p>
826
827<p>Signal an existing application to gracefully shut itself down, and
828remove it from Tomcat (which also makes this context path available for
829reuse later). In addition, the document root directory is removed, if it
830exists in the <code>appBase</code> directory (typically "webapps") for
831this virtual host. This command is the logical opposite of the
832<code>/deploy</code> command.</p>
833
834<p>If this command succeeds, you will see a response like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800835<div class="codeBox"><pre><code>OK - Undeployed application at context path /examples</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800836
837<p>Otherwise, the response will start with <code>FAIL</code> and include an
838error message. Possible causes for problems include:</p>
839<ul>
840<li><em>Encountered exception</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800841 <p>An exception was encountered trying to undeploy the web application.
刘洪青6266f992017-05-15 21:21:03 +0800842 Check the Tomcat logs for the details.</p>
843 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800844<li><em>Invalid context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800845 <p>The context path must start with a slash character. To reference the
846 ROOT web application use "/".</p>
刘洪青6266f992017-05-15 21:21:03 +0800847 </li>
848<li><em>No context exists named /foo</em>
849 <p>There is no deployed application with the name that you specified.</p>
850 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800851<li><em>No context path was specified</em>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800852 The <code>path</code> parameter is required.
刘洪青6266f992017-05-15 21:21:03 +0800853 </li>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800854</ul>
855
856</blockquote></td></tr></table>
857
858<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Finding memory leaks"><!--()--></a><a name="Finding_memory_leaks"><strong>Finding memory leaks</strong></a></font></td></tr><tr><td><blockquote>
859
刘洪青6266f992017-05-15 21:21:03 +0800860<div class="codeBox"><pre><code>http://localhost:8080/manager/text/findleaks[?statusLine=[true|false]]</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800861
862<p><strong>The find leaks diagnostic triggers a full garbage collection. It
863should be used with extreme caution on production systems.</strong></p>
864
865<p>The find leaks diagnostic attempts to identify web applications that have
866caused memory leaks when they were stopped, reloaded or undeployed. Results
867should always be confirmed
868with a profiler. The diagnostic uses additional functionality provided by the
869StandardHost implementation. It will not work if a custom host is used that
870does not extend StandardHost.</p>
871
872<p>Explicitly triggering a full garbage collection from Java code is documented
873to be unreliable. Furthermore, depending on the JVM used, there are options to
874disable explicit GC triggering, like <code>-XX:+DisableExplicitGC</code>.
刘洪青6266f992017-05-15 21:21:03 +0800875If you want to make sure, that the diagnostics were successfully running a full
876GC, you will need to check using tools like GC logging, JConsole or similar.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800877
878<p>If this command succeeds, you will see a response like this:</p>
刘洪青6266f992017-05-15 21:21:03 +0800879<div class="codeBox"><pre><code>/leaking-webapp</code></pre></div>
880
881<p>If you wish to see a status line included in the response then include the
882<code>statusLine</code> query parameter in the request with a value of
883<code>true</code>.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800884
885<p>Each context path for a web application that was stopped, reloaded or
886undeployed, but which classes from the previous runs are still loaded in memory,
887thus causing a memory leak, will be listed on a new line. If an application
888has been reloaded several times, it may be listed several times.</p>
889
890<p>If the command does not succeed, the response will start with
891<code>FAIL</code> and include an error message.</p>
刘洪青6266f992017-05-15 21:21:03 +0800892
Hongqing Liufd5ee812014-05-10 16:32:51 +0800893</blockquote></td></tr></table>
894
刘洪青6266f992017-05-15 21:21:03 +0800895<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Thread Dump"><!--()--></a><a name="Thread_Dump"><strong>Thread Dump</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800896
刘洪青6266f992017-05-15 21:21:03 +0800897<div class="codeBox"><pre><code>http://localhost:8080/manager/text/threaddump</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800898
刘洪青6266f992017-05-15 21:21:03 +0800899<p>Write a JVM thread dump.</p>
900
901<p>The response will look something like this:</p>
902<div class="codeBox"><pre><code>OK - JVM thread dump
9032014-12-08 07:24:40.080
904Full thread dump Java HotSpot(TM) Client VM (25.25-b02 mixed mode):
905
906"http-nio-8080-exec-2" Id=26 cpu=46800300 ns usr=46800300 ns blocked 0 for -1 ms waited 0 for -1 ms
907 java.lang.Thread.State: RUNNABLE
908 locks java.util.concurrent.ThreadPoolExecutor$Worker@1738ad4
909 at sun.management.ThreadImpl.dumpThreads0(Native Method)
910 at sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:446)
911 at org.apache.tomcat.util.Diagnostics.getThreadDump(Diagnostics.java:440)
912 at org.apache.tomcat.util.Diagnostics.getThreadDump(Diagnostics.java:409)
913 at org.apache.catalina.manager.ManagerServlet.threadDump(ManagerServlet.java:557)
914 at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:371)
915 at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
916 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
917...
918</code></pre></div>
919
920</blockquote></td></tr></table>
921
922<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="VM Info"><!--()--></a><a name="VM_Info"><strong>VM Info</strong></a></font></td></tr><tr><td><blockquote>
923
924<div class="codeBox"><pre><code>http://localhost:8080/manager/text/vminfo</code></pre></div>
925
926<p>Write some diagnostic information about Java Virtual Machine.</p>
927
928<p>The response will look something like this:</p>
929<div class="codeBox"><pre><code>OK - VM info
9302014-12-08 07:27:32.578
931Runtime information:
932 vmName: Java HotSpot(TM) Client VM
933 vmVersion: 25.25-b02
934 vmVendor: Oracle Corporation
935 specName: Java Virtual Machine Specification
936 specVersion: 1.8
937 specVendor: Oracle Corporation
938 managementSpecVersion: 1.2
939 name: ...
940 startTime: 1418012458849
941 uptime: 393855
942 isBootClassPathSupported: true
943
944OS information:
945...
946</code></pre></div>
947
948</blockquote></td></tr></table>
949
950</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Server Status"><!--()--></a><a name="Server_Status"><strong>Server Status</strong></a></font></td></tr><tr><td><blockquote>
951
952<p>From the following links you can view Status information about the server.
953Any one of <strong>manager-xxx</strong> roles allows access to this page.</p>
954
955<div class="codeBox"><pre><code>http://localhost:8080/manager/status
956http://localhost:8080/manager/status/all</code></pre></div>
957
958<p>Displays server status information in HTML format.</p>
959
960<div class="codeBox"><pre><code>http://localhost:8080/manager/status?XML=true
961http://localhost:8080/manager/status/all?XML=true</code></pre></div>
962
963<p>Displays server status information in XML format.</p>
964
965<p>First, you have the server and JVM version number, JVM provider, OS name
Hongqing Liufd5ee812014-05-10 16:32:51 +0800966and number followed by the architecture type.</p>
967
刘洪青6266f992017-05-15 21:21:03 +0800968<p>Second, there is information about the memory usage of the JVM.</p>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800969
刘洪青6266f992017-05-15 21:21:03 +0800970<p>Then, there is information about the Tomcat AJP and HTTP connectors.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800971The same information is available for both of them :
972</p>
973<ul>
刘洪青6266f992017-05-15 21:21:03 +0800974 <li><p>Threads information : Max threads, min and max spare threads,
Hongqing Liufd5ee812014-05-10 16:32:51 +0800975 current thread count and current thread busy.</p></li>
刘洪青6266f992017-05-15 21:21:03 +0800976 <li><p>Request information : Max processing time and processing time,
Hongqing Liufd5ee812014-05-10 16:32:51 +0800977 request and error count, bytes received and sent.</p></li>
刘洪青6266f992017-05-15 21:21:03 +0800978 <li><p>A table showing Stage, Time, Bytes Sent, Bytes Receive, Client,
979 VHost and Request. All existing threads are listed in the table.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800980 Here is the list of the possible thread stages :</p>
981 <ul>
982 <li><p><em>"Parse and Prepare Request"</em> : The request headers are
983 being parsed or the necessary preparation to read the request body (if
984 a transfer encoding has been specified) is taking place.</p></li>
985 <li><p><em>"Service"</em> : The thread is processing a request and
986 generating the response. This stage follows the "Parse and Prepare
987 Request" stage and precedes the "Finishing" stage. There is always at
988 least one thread in this stage (the server-status page).</p></li>
989 <li><p><em>"Finishing"</em> : The end of the request processing. Any
990 remainder of the response still in the output buffers is sent to the
991 client. This stage is followed by "Keep-Alive" if it is appropriate to
992 keep the connection alive or "Ready" if "Keep-Alive" is not
993 appropriate.</p></li>
994 <li><p><em>"Keep-Alive"</em> : The thread keeps the connection open to
995 the client in case the client sends another request. If another request
刘洪青6266f992017-05-15 21:21:03 +0800996 is received, the next stage will be "Parse and Prepare Request". If no
Hongqing Liufd5ee812014-05-10 16:32:51 +0800997 request is received before the keep alive times out, the connection will
998 be closed and the next stage will be "Ready".</p></li>
999 <li><p><em>"Ready"</em> : The thread is at rest and ready to be
1000 used.</p></li>
1001 </ul>
1002 </li>
1003</ul>
刘洪青6266f992017-05-15 21:21:03 +08001004
1005<p>If you are using <code>/status/all</code> command, additional information
1006on each of deployed web applications will be available.</p>
1007
1008</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Using the JMX Proxy Servlet"><!--()--></a><a name="Using_the_JMX_Proxy_Servlet"><strong>Using the JMX Proxy Servlet</strong></a></font></td></tr><tr><td><blockquote>
1009
1010 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="What is JMX Proxy Servlet"><!--()--></a><a name="What_is_JMX_Proxy_Servlet"><strong>What is JMX Proxy Servlet</strong></a></font></td></tr><tr><td><blockquote>
1011 The JMX Proxy Servlet is a lightweight proxy to get and set the
1012 tomcat internals. (Or any class that has been exposed via an MBean)
1013 Its usage is not very user friendly but the UI is
1014 extremely helpful for integrating command line scripts for monitoring
1015 and changing the internals of tomcat. You can do two things with the proxy:
1016 get information and set information. For you to really understand the
1017 JMX Proxy Servlet, you should have a general understanding of JMX.
1018 If you don't know what JMX is, then prepare to be confused.
1019 </blockquote></td></tr></table>
1020
1021 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="JMX Query command"><!--()--></a><a name="JMX_Query_command"><strong>JMX Query command</strong></a></font></td></tr><tr><td><blockquote>
1022 <p>This takes the form:</p>
1023<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/?qry=STUFF</code></pre></div>
1024 <p>Where <code>STUFF</code> is the JMX query you wish to perform. For example,
1025 here are some queries you might wish to run:</p>
1026 <ul>
1027 <li>
1028 <code>qry=*%3Atype%3DRequestProcessor%2C* --&gt;
1029 type=RequestProcessor</code> which will locate all
1030 workers which can process requests and report
1031 their state.
1032 </li>
1033 <li>
1034 <code>qry=*%3Aj2eeType=Servlet%2c* --&gt;
1035 j2eeType=Servlet</code> which return all loaded servlets.
1036 </li>
1037 <li>
1038 <code>qry=Catalina%3Atype%3DEnvironment%2Cresourcetype%3DGlobal%2Cname%3DsimpleValue --&gt;
1039 Catalina:type=Environment,resourcetype=Global,name=simpleValue</code>
1040 which look for a specific MBean by the given name.
1041 </li>
1042 </ul>
1043 <p>
1044 You'll need to experiment with this to really understand its capabilities
1045 If you provide no <code>qry</code> parameter, then all of the MBeans will
1046 be displayed. We really recommend looking at the tomcat source code and
1047 understand the JMX spec to get a better understanding of all the queries
1048 you may run.
1049 </p>
1050 </blockquote></td></tr></table>
1051
1052 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="JMX Get command"><!--()--></a><a name="JMX_Get_command"><strong>JMX Get command</strong></a></font></td></tr><tr><td><blockquote>
1053 <p>
1054 The JXMProxyServlet also supports a "get" command that you can use to
1055 fetch the value of a specific MBean's attribute. The general form of
1056 the <code>get</code> command is:
1057 </p>
1058
1059<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/?get=BEANNAME&amp;att=MYATTRIBUTE&amp;key=MYKEY</code></pre></div>
1060
1061 <p>You must provide the following parameters:</p>
1062 <ol>
1063 <li><code>get</code>: The full bean name</li>
1064 <li><code>att</code>: The attribute you wish to fetch</li>
1065 <li><code>key</code>: (optional) The key into a CompositeData MBean attribute</li>
1066 </ol>
1067 <p>
1068 If all goes well, then it will say OK, otherwise an error message will
1069 be shown. For example, let's say we wish to fetch the current heap memory
1070 data:
1071 </p>
1072
1073<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/?get=java.lang:type=Memory&amp;att=HeapMemoryUsage</code></pre></div>
1074
1075 <p>Or, if you only want the "used" key:</p>
1076
1077<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/
1078 ?get=java.lang:type=Memory&amp;att=HeapMemoryUsage&amp;key=used</code></pre></div>
1079 </blockquote></td></tr></table>
1080
1081 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="JMX Set command"><!--()--></a><a name="JMX_Set_command"><strong>JMX Set command</strong></a></font></td></tr><tr><td><blockquote>
1082 <p>
1083 Now that you can query an MBean, its time to muck with Tomcat's internals!
1084 The general form of the set command is :
1085 </p>
1086<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/?set=BEANNAME&amp;att=MYATTRIBUTE&amp;val=NEWVALUE</code></pre></div>
1087 <p>So you need to provide 3 request parameters:</p>
1088 <ol>
1089 <li><code>set</code>: The full bean name</li>
1090 <li><code>att</code>: The attribute you wish to alter</li>
1091 <li><code>val</code>: The new value </li>
1092 </ol>
1093 <p>
1094 If all goes ok, then it will say OK, otherwise an error message will be
1095 shown. For example, lets say we wish to turn up debugging on the fly for the
1096 <code>ErrorReportValve</code>. The following will set debugging to 10.
1097 </p>
1098<div class="codeBox"><pre><code>http://localhost:8080/manager/jmxproxy/
1099 ?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost
1100 &amp;att=debug&amp;val=10</code></pre></div>
1101 <p>and my result is (YMMV):</p>
1102<div class="codeBox"><pre><code>Result: ok</code></pre></div>
1103
1104 <p>Here is what I see if I pass in a bad value. Here is the URL I used,
1105 I try set debugging equal to 'cow':</p>
1106<div class="codeBox"><pre><code>http://localhost:8080/manager/jmxproxy/
1107 ?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost
1108 &amp;att=debug&amp;val=cow</code></pre></div>
1109 <p>When I try that, my result is</p>
1110<div class="codeBox"><pre><code>Error: java.lang.NumberFormatException: For input string: "cow"</code></pre></div>
1111 </blockquote></td></tr></table>
1112
1113 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="JMX Invoke command"><!--()--></a><a name="JMX_Invoke_command"><strong>JMX Invoke command</strong></a></font></td></tr><tr><td><blockquote>
1114 <p>The <code>invoke</code> command enables methods to be called on MBeans. The
1115 general form of the command is:</p>
1116<div class="codeBox"><pre><code>http://webserver/manager/jmxproxy/
1117 ?invoke=BEANNAME&amp;op=METHODNAME&amp;ps=COMMASEPARATEDPARAMETERS</code></pre></div>
1118 <p>For example, to call the <code>findConnectors()</code> method of the
1119 <strong>Service</strong> use:</p>
1120<div class="codeBox"><pre><code>http://localhost:8080/manager/jmxproxy/
1121 ?invoke=Catalina%3Atype%3DService&amp;op=findConnectors&amp;ps=</code></pre></div>
1122 </blockquote></td></tr></table>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001123
1124</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Executing Manager Commands With Ant"><!--()--></a><a name="Executing_Manager_Commands_With_Ant"><strong>Executing Manager Commands With Ant</strong></a></font></td></tr><tr><td><blockquote>
1125
1126<p>In addition to the ability to execute Manager commands via HTTP requests,
刘洪青6266f992017-05-15 21:21:03 +08001127as documented above, Tomcat includes a convenient set of Task definitions
Hongqing Liufd5ee812014-05-10 16:32:51 +08001128for the <em>Ant</em> (version 1.4 or later) build tool. In order to use these
1129commands, you must perform the following setup operations:</p>
1130<ul>
1131<li>Download the binary distribution of Ant from
1132 <a href="http://ant.apache.org">http://ant.apache.org</a>.
1133 You must use version <strong>1.4</strong> or later.</li>
1134<li>Install the Ant distribution in a convenient directory (called
1135 ANT_HOME in the remainder of these instructions).</li>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001136<li>Add the <code>$ANT_HOME/bin</code> directory to your <code>PATH</code>
1137 environment variable.</li>
1138<li>Configure at least one username/password combination in your Tomcat
1139 user database that includes the <code>manager-script</code> role.</li>
1140</ul>
1141
刘洪青6266f992017-05-15 21:21:03 +08001142<p>To use custom tasks within Ant, you must declare them first with an
1143<code>&lt;import&gt;</code> element. Therefore, your <code>build.xml</code>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001144file might look something like this:</p>
1145
刘洪青6266f992017-05-15 21:21:03 +08001146<div class="codeBox"><pre><code>&lt;project name="My Application" default="compile" basedir="."&gt;
Hongqing Liufd5ee812014-05-10 16:32:51 +08001147
1148 &lt;!-- Configure the directory into which the web application is built --&gt;
1149 &lt;property name="build" value="${basedir}/build"/&gt;
1150
1151 &lt;!-- Configure the context path for this application --&gt;
1152 &lt;property name="path" value="/myapp"/&gt;
1153
1154 &lt;!-- Configure properties to access the Manager application --&gt;
刘洪青6266f992017-05-15 21:21:03 +08001155 &lt;property name="url" value="http://localhost:8080/manager/text"/&gt;
Hongqing Liufd5ee812014-05-10 16:32:51 +08001156 &lt;property name="username" value="myusername"/&gt;
1157 &lt;property name="password" value="mypassword"/&gt;
1158
刘洪青6266f992017-05-15 21:21:03 +08001159 &lt;!-- Configure the path to the Tomcat installation --&gt;
1160 &lt;property name="catalina.home" value="/usr/local/apache-tomcat"/&gt;
1161
Hongqing Liufd5ee812014-05-10 16:32:51 +08001162 &lt;!-- Configure the custom Ant tasks for the Manager application --&gt;
刘洪青6266f992017-05-15 21:21:03 +08001163 &lt;import file="${catalina.home}/bin/catalina-tasks.xml"/&gt;
Hongqing Liufd5ee812014-05-10 16:32:51 +08001164
1165 &lt;!-- Executable Targets --&gt;
1166 &lt;target name="compile" description="Compile web application"&gt;
1167 &lt;!-- ... construct web application in ${build} subdirectory, and
1168 generated a ${path}.war ... --&gt;
1169 &lt;/target&gt;
1170
1171 &lt;target name="deploy" description="Install web application"
1172 depends="compile"&gt;
1173 &lt;deploy url="${url}" username="${username}" password="${password}"
1174 path="${path}" war="file:${build}${path}.war"/&gt;
1175 &lt;/target&gt;
1176
1177 &lt;target name="reload" description="Reload web application"
1178 depends="compile"&gt;
1179 &lt;reload url="${url}" username="${username}" password="${password}"
1180 path="${path}"/&gt;
1181 &lt;/target&gt;
1182
1183 &lt;target name="undeploy" description="Remove web application"&gt;
1184 &lt;undeploy url="${url}" username="${username}" password="${password}"
1185 path="${path}"/&gt;
1186 &lt;/target&gt;
1187
刘洪青6266f992017-05-15 21:21:03 +08001188&lt;/project&gt;</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001189
刘洪青6266f992017-05-15 21:21:03 +08001190<p>Note: The definition of the resources task via the import above will override
1191the resources datatype added in Ant 1.7. If you wish to use the resources
1192datatype you will need to use Ant's namespace support to modify
1193<code>catalina-tasks.xml</code> to assign the Tomcat tasks to their own
Hongqing Liufd5ee812014-05-10 16:32:51 +08001194namespace.</p>
1195
1196<p>Now, you can execute commands like <code>ant deploy</code> to deploy the
1197application to a running instance of Tomcat, or <code>ant reload</code> to
1198tell Tomcat to reload it. Note also that most of the interesting values in
1199this <code>build.xml</code> file are defined as replaceable properties, so
1200you can override their values from the command line. For example, you might
1201consider it a security risk to include the real manager password in your
1202<code>build.xml</code> file's source code. To avoid this, omit the password
1203property, and specify it from the command line:</p>
刘洪青6266f992017-05-15 21:21:03 +08001204<div class="codeBox"><pre><code>ant -Dpassword=secret deploy</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001205
1206<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Tasks output capture"><!--()--></a><a name="Tasks_output_capture"><strong>Tasks output capture</strong></a></font></td></tr><tr><td><blockquote>
1207
1208<p>Using <em>Ant</em> version <strong>1.6.2</strong> or later,
刘洪青6266f992017-05-15 21:21:03 +08001209the Catalina tasks offer the option to capture their output in
1210properties or external files. They support directly the following subset of the
Hongqing Liufd5ee812014-05-10 16:32:51 +08001211<code>&lt;redirector&gt;</code> type attributes:
1212</p>
1213
刘洪青6266f992017-05-15 21:21:03 +08001214<table class="defaultTable">
Hongqing Liufd5ee812014-05-10 16:32:51 +08001215<tr>
刘洪青6266f992017-05-15 21:21:03 +08001216<th>Attribute</th>
1217<th>Description</th>
1218<th style="text-align: center;">Required</th>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001219</tr>
1220<tr>
刘洪青6266f992017-05-15 21:21:03 +08001221<td>output</td>
1222<td>Name of a file to which to write the output. If
Hongqing Liufd5ee812014-05-10 16:32:51 +08001223the error stream is not also redirected to a file or property, it will
1224appear in this output.</td>
刘洪青6266f992017-05-15 21:21:03 +08001225<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001226</tr>
1227<tr>
刘洪青6266f992017-05-15 21:21:03 +08001228<td>error</td>
1229<td>The file to which the standard error of the
Hongqing Liufd5ee812014-05-10 16:32:51 +08001230command should be redirected.</td>
刘洪青6266f992017-05-15 21:21:03 +08001231<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001232</tr>
1233<tr>
刘洪青6266f992017-05-15 21:21:03 +08001234<td>logError</td>
1235<td>This attribute is used when you wish to see
Hongqing Liufd5ee812014-05-10 16:32:51 +08001236error output in Ant's log and you are redirecting output to a
1237file/property. The error output will not be included in the output
1238file/property. If you redirect error with the <i>error</i> or <i>errorProperty</i>
1239attributes, this will have no effect.</td>
刘洪青6266f992017-05-15 21:21:03 +08001240<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001241</tr>
1242<tr>
刘洪青6266f992017-05-15 21:21:03 +08001243<td>append</td>
1244<td>Whether output and error files should be
Hongqing Liufd5ee812014-05-10 16:32:51 +08001245appended to or overwritten. Defaults to <code>false</code>.</td>
刘洪青6266f992017-05-15 21:21:03 +08001246<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001247</tr>
1248<tr>
刘洪青6266f992017-05-15 21:21:03 +08001249<td>createemptyfiles</td>
1250<td>Whether output and error files should be created
Hongqing Liufd5ee812014-05-10 16:32:51 +08001251even when empty. Defaults to <code>true</code>.</td>
刘洪青6266f992017-05-15 21:21:03 +08001252<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001253</tr>
1254<tr>
刘洪青6266f992017-05-15 21:21:03 +08001255<td>outputproperty</td>
1256<td>The name of a property in which the output of
Hongqing Liufd5ee812014-05-10 16:32:51 +08001257the command should be stored. Unless the error stream is redirected to
1258a separate file or stream, this property will include the error output.</td>
刘洪青6266f992017-05-15 21:21:03 +08001259<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001260</tr>
1261<tr>
刘洪青6266f992017-05-15 21:21:03 +08001262<td>errorproperty</td>
1263<td>The name of a property in which the standard
Hongqing Liufd5ee812014-05-10 16:32:51 +08001264error of the command should be stored.</td>
刘洪青6266f992017-05-15 21:21:03 +08001265<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001266</tr>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001267</table>
1268
1269<p>A couple of additional attributes can also be specified:
1270</p>
刘洪青6266f992017-05-15 21:21:03 +08001271<table class="defaultTable">
Hongqing Liufd5ee812014-05-10 16:32:51 +08001272<tr>
刘洪青6266f992017-05-15 21:21:03 +08001273<th>Attribute</th>
1274<th>Description</th>
1275<th style="text-align: center;">Required</th>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001276</tr>
1277<tr>
刘洪青6266f992017-05-15 21:21:03 +08001278<td>alwaysLog</td>
1279<td>This attribute is used when you wish to see the
Hongqing Liufd5ee812014-05-10 16:32:51 +08001280output you are capturing, appearing also in the Ant's log. It must not be
1281used unless you are capturing task output.
1282Defaults to <code>false</code>.
1283<em>This attribute will be supported directly by <code>&lt;redirector&gt;</code>
1284in Ant 1.6.3</em></td>
刘洪青6266f992017-05-15 21:21:03 +08001285<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001286</tr>
1287<tr>
刘洪青6266f992017-05-15 21:21:03 +08001288<td>failonerror</td>
1289<td>This attribute is used when you wish to avoid that
Hongqing Liufd5ee812014-05-10 16:32:51 +08001290any manager command processing error terminates the ant execution. Defaults to <code>true</code>.
1291It must be set to <code>false</code>, if you want to capture error output,
1292otherwise execution will terminate before anything can be captured.
1293<br>
1294This attribute acts only on manager command execution,
1295any wrong or missing command attribute will still cause Ant execution termination.
1296</td>
刘洪青6266f992017-05-15 21:21:03 +08001297<td style="text-align: center;">No</td>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001298</tr>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001299</table>
1300
1301<p>They also support the embedded <code>&lt;redirector&gt;</code> element
1302in which you can specify
刘洪青6266f992017-05-15 21:21:03 +08001303its full set of attributes, but <code>input</code>, <code>inputstring</code> and
Hongqing Liufd5ee812014-05-10 16:32:51 +08001304<code>inputencoding</code> that, even if accepted, are not used because they have
1305no meaning in this context.
刘洪青6266f992017-05-15 21:21:03 +08001306Refer to <a href="http://ant.apache.org">ant manual</a> for details on
Hongqing Liufd5ee812014-05-10 16:32:51 +08001307<code>&lt;redirector&gt;</code> element attributes.
1308</p>
1309
1310<p>
1311Here is a sample build file extract that shows how this output redirection support
1312can be used:
1313</p>
1314
刘洪青6266f992017-05-15 21:21:03 +08001315<div class="codeBox"><pre><code> &lt;target name="manager.deploy"
1316 depends="context.status"
1317 if="context.notInstalled"&gt;
1318 &lt;deploy url="${mgr.url}"
1319 username="${mgr.username}"
1320 password="${mgr.password}"
1321 path="${mgr.context.path}"
1322 config="${mgr.context.descriptor}"/&gt;
1323 &lt;/target&gt;
Hongqing Liufd5ee812014-05-10 16:32:51 +08001324
刘洪青6266f992017-05-15 21:21:03 +08001325 &lt;target name="manager.deploy.war"
1326 depends="context.status"
1327 if="context.deployable"&gt;
1328 &lt;deploy url="${mgr.url}"
1329 username="${mgr.username}"
1330 password="${mgr.password}"
1331 update="${mgr.update}"
1332 path="${mgr.context.path}"
1333 war="${mgr.war.file}"/&gt;
1334 &lt;/target&gt;
1335
1336 &lt;target name="context.status"&gt;
1337 &lt;property name="running" value="${mgr.context.path}:running"/&gt;
1338 &lt;property name="stopped" value="${mgr.context.path}:stopped"/&gt;
1339
1340 &lt;list url="${mgr.url}"
1341 outputproperty="ctx.status"
1342 username="${mgr.username}"
1343 password="${mgr.password}"&gt;
1344 &lt;/list&gt;
1345
1346 &lt;condition property="context.running"&gt;
1347 &lt;contains string="${ctx.status}" substring="${running}"/&gt;
1348 &lt;/condition&gt;
1349 &lt;condition property="context.stopped"&gt;
1350 &lt;contains string="${ctx.status}" substring="${stopped}"/&gt;
1351 &lt;/condition&gt;
1352 &lt;condition property="context.notInstalled"&gt;
1353 &lt;and&gt;
1354 &lt;isfalse value="${context.running}"/&gt;
1355 &lt;isfalse value="${context.stopped}"/&gt;
1356 &lt;/and&gt;
1357 &lt;/condition&gt;
1358 &lt;condition property="context.deployable"&gt;
1359 &lt;or&gt;
1360 &lt;istrue value="${context.notInstalled}"/&gt;
1361 &lt;and&gt;
1362 &lt;istrue value="${context.running}"/&gt;
1363 &lt;istrue value="${mgr.update}"/&gt;
1364 &lt;/and&gt;
1365 &lt;and&gt;
1366 &lt;istrue value="${context.stopped}"/&gt;
1367 &lt;istrue value="${mgr.update}"/&gt;
1368 &lt;/and&gt;
1369 &lt;/or&gt;
1370 &lt;/condition&gt;
1371 &lt;condition property="context.undeployable"&gt;
1372 &lt;or&gt;
1373 &lt;istrue value="${context.running}"/&gt;
1374 &lt;istrue value="${context.stopped}"/&gt;
1375 &lt;/or&gt;
1376 &lt;/condition&gt;
1377 &lt;/target&gt;</code></pre></div>
Hongqing Liufd5ee812014-05-10 16:32:51 +08001378
1379<p><strong>WARNING:</strong> even if it doesn't make many sense, and is always a bad idea,
1380calling a Catalina task more than once,
1381badly set Ant tasks depends chains may cause that a task be called
1382more than once in the same Ant run, even if not intended to. A bit of caution should be exercised when you are
1383capturing output from that task, because this could lead to something unexpected:</p>
1384<ul>
1385<li>when capturing in a property you will find in it only the output from the <em>first</em> call, because
1386Ant properties are immutable and once set they cannot be changed,
1387</li>
1388<li>when capturing in a file, each run will overwrite it and you will find in it only the <em>last</em> call
1389output, unless you are using the <code>append="true"</code> attribute, in which case you will
1390see the output of each task call appended to the file.
1391</li>
1392</ul>
1393
1394</blockquote></td></tr></table>
1395
刘洪青6266f992017-05-15 21:21:03 +08001396</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
1397 on improving documentation for Apache Tomcat.<br><br>
1398 If you have trouble and need help, read
1399 <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
1400 and ask your question on the tomcat-users
1401 <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
1402 Do not ask such questions here. This is not a Q&amp;A section.<br><br>
1403 The Apache Comments System is explained <a href="./comments.html">here</a>.
1404 Comments may be removed by our moderators if they are either
1405 implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
1406 var comments_shortname = 'tomcat';
1407 var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html';
1408 (function(w, d) {
1409 if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
1410 d.write('<div id="comments_thread"><\/div>');
1411 var s = d.createElement('script');
1412 s.type = 'text/javascript';
1413 s.async = true;
1414 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
1415 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
1416 }
1417 else {
1418 d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
1419 }
1420 })(window, document);
1421 //--><!]]></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>
1422 Copyright &copy; 1999-2017, Apache Software Foundation
Hongqing Liufd5ee812014-05-10 16:32:51 +08001423 </em></font></div></td></tr></table></body></html>