blob: 7804a1c742348e522b0be1043f8d90ed6ae884d4 [file] [log] [blame]
Cheng Tang07b30872014-04-27 16:37:18 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.42) - 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">
5 code {background-color:rgb(224,255,255);padding:0 0.1em;}
6 code.attributeName, code.propertyName {background-color:transparent;}
7 </style><style type="text/css">
8 .wrapped-source code { display: block; background-color: transparent; }
9 .wrapped-source div { margin: 0 0 0 1.25em; }
10 .wrapped-source p { margin: 0 0 0 1.25em; text-indent: -1.25em; }
11 </style><style type="text/css">
12 p.notice {
13 border: 1px solid rgb(255, 0, 0);
14 background-color: rgb(238, 238, 238);
15 color: rgb(0, 51, 102);
16 padding: 0.5em;
17 margin: 1em 2em 1em 1em;
18 }
19 </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="./images/tomcat.gif" align="right" alt="
20 The Apache Tomcat Servlet/JSP Container
21 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.42, Jul 2 2013</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>User Guide</strong></p><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="realm-howto.html">6) Realms and AAA</a></li><li><a href="security-manager-howto.html">7) Security Manager</a></li><li><a href="jndi-resources-howto.html">8) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">9) JDBC DataSources</a></li><li><a href="class-loader-howto.html">10) Classloading</a></li><li><a href="jasper-howto.html">11) JSPs</a></li><li><a href="ssl-howto.html">12) SSL</a></li><li><a href="ssi-howto.html">13) SSI</a></li><li><a href="cgi-howto.html">14) CGI</a></li><li><a href="proxy-howto.html">15) Proxy Support</a></li><li><a href="mbeans-descriptor-howto.html">16) MBean Descriptor</a></li><li><a href="default-servlet.html">17) Default Servlet</a></li><li><a href="cluster-howto.html">18) Clustering</a></li><li><a href="balancer-howto.html">19) Load Balancer</a></li><li><a href="connectors.html">20) Connectors</a></li><li><a href="monitoring.html">21) Monitoring and Management</a></li><li><a href="logging.html">22) Logging</a></li><li><a href="apr.html">23) APR/Native</a></li><li><a href="virtual-hosting-howto.html">24) Virtual Hosting</a></li><li><a href="aio.html">25) Advanced IO</a></li><li><a href="extras.html">26) Additional Components</a></li><li><a href="maven-jars.html">27) Mavenized</a></li><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</a></li></ul><p><strong>Reference</strong></p><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.2 Javadocs</a></li><li><a href="elapi/index.html">EL 2.2 Javadocs</a></li><li><a href="http://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul><p><strong>Apache Tomcat Development</strong></p><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="http://wiki.apache.org/tomcat/TomcatVersions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="funcspecs/index.html">Functional Specs.</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>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>
22<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Configuring_Manager_Application_Access">Configuring Manager Application Access</a></li><li><a href="#Supported_Manager_Commands">Supported Manager Commands</a><ol><li><a href="#Deploy_A_New_Application_Remotely">Deploy A New Application Remotely</a></li><li><a href="#Deploy_A_New_Application_from_a_Local_Path">Deploy A New Application from a Local Path</a></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="#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="#Server_Status">Server Status</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><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></ul>
23</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
24
25<p>In many production environments, it is very useful to have the capability
26to deploy a new web application, or undeploy an existing one, without having
27to shut down and restart the entire container. In addition, you can request
28an existing application to reload itself, even if you have not declared it
29to be <code>reloadable</code> in the Tomcat server
30configuration file.</p>
31
32<p>To support these capabilities, Tomcat includes a web application
33(installed by default on context path <code>/manager</code>) that supports
34the following functions:</p>
35<ul>
36<li>Deploy a new web application from the uploaded contents of a WAR file.</li>
37<li>Deploy a new web application, on a specified context path, from the
38 server file system.</li>
39<li>List the currently deployed web applications, as well as the
40 sessions that are currently active for those web apps.</li>
41<li>Reload an existing web application, to reflect changes in the
42 contents of <code>/WEB-INF/classes</code> or <code>/WEB-INF/lib</code>.
43 </li>
44<li>List the OS and JVM property values.</li>
45<li>List the available global JNDI resources, for use in deployment
46 tools that are preparing <code>&lt;ResourceLink&gt;</code> elements
47 nested in a <code>&lt;Context&gt;</code> deployment description.</li>
48<li>Start a stopped application (thus making it available again).</li>
49<li>Stop an existing application (so that it becomes unavailable), but
50 do not undeploy it.</li>
51<li>Undeploy a deployed web application and delete its document base
52 directory (unless it was deployed from file system).</li>
53</ul>
54
55<p>A default Tomcat installation includes the Manager. To add an instance of the
56Manager web application <code>Context</code> to a new host install the
57<code>manager.xml</code> context configuration file in the
58<code>$CATALINA_BASE/conf/[enginename]/[hostname]</code> folder. Here is an
59example:</p>
60<pre>
61&lt;Context privileged="true" antiResourceLocking="false"
62 docBase="${catalina.home}/webapps/manager"&gt;
63 &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
64 allow="127\.0\.0\.1" /&gt;
65&lt;/Context&gt;
66</pre>
67
68<p>If you have Tomcat configured to support multiple virtual hosts
69(websites) you would need to configure a Manager for each.</p>
70
71<p>There are three ways to use the <strong>Manager</strong> web application.</p>
72<ul>
73<li>As an application with a user interface you use in your browser.
74Here is an example URL where you can replace <code>localhost</code> with
75your website host name: <code>http://localhost/manager/html/</code> .</li>
76<li>A minimal version using HTTP requests only which is suitable for use
77by scripts setup by system administrators. Commands are given as part of the
78request URI, and responses are in the form of simple text that can be easily
79parsed and processed. See <a href="#Supported Manager Commands">
80Supported Manager Commands</a> for more information.</li>
81<li>A convenient set of task definitions for the <em>Ant</em>
82(version 1.4 or later) build tool. See
83<a href="#Executing Manager Commands With Ant">Executing Manager Commands
84With Ant</a> for more information.</li>
85</ul>
86
87</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>
88
89 <blockquote>
90 <p><em>The description below uses the variable name $CATALINA_BASE to refer the
91 base directory against which most relative paths are resolved. If you have
92 not configured Tomcat for multiple instances by setting a CATALINA_BASE
93 directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
94 the directory into which you have installed Tomcat.</em></p>
95 </blockquote>
96
97<p>It would be quite unsafe to ship Tomcat with default settings that allowed
98anyone on the Internet to execute the Manager application on your server.
99Therefore, the Manager application is shipped with the requirement that anyone
100who attempts to use it must authenticate themselves, using a username and
101password that have one of <strong>manager-**</strong> roles associated with
102them (the role name depends on what functionality is required).
103Further, there is no username in the default users file
104(<code>$CATALINA_BASE/conf/tomcat-users.xml</code>) that is assigned to those
105roles. Therefore, access to the Manager application is completely disabled
106by default.</p>
107
108<p>You can find the role names in the <code>web.xml</code> file of the Manager
109web application. The available roles are:</p>
110
111<ul>
112 <li><strong>manager-gui</strong> &mdash; Access to the HTML interface.</li>
113 <li><strong>manager-status</strong> &mdash; Access to the "Server Status"
114 page only.</li>
115 <li><strong>manager-script</strong> &mdash; Access to the tools-friendly
116 plain text interface that is described in this document,
117 and to the "Server Status" page.</li>
118 <li><strong>manager-jmx</strong> &mdash; Access to JMX proxy interface
119 and to the "Server Status" page.</li>
120</ul>
121
122<p>The HTML interface is protected against CSRF (Cross-Site Request Forgery)
123attacks, but the text and JMX interfaces cannot be protected. To maintain
124the CSRF protection:</p>
125
126<ul>
127 <li>Users with the <strong>manager-gui</strong> role should not be granted
128 the <strong>manager-script</strong> or <strong>manager-jmx</strong>
129 roles.</li>
130 <li>If you use web browser to access the Manager application using
131 a user that has either <strong>manager-script</strong> or
132 <strong>manager-jmx</strong> roles (for example for testing
133 the plain text or JMX interfaces),
134 then all windows of the browser MUST be closed afterwards to terminate
135 the session.</li>
136</ul>
137
138<p>Note that JMX proxy interface is effectively low-level root-like
139administrative interface of Tomcat. One can do a lot, if he knows
140what commands to call. You should be cautious when enabling the
141<strong>manager-jmx</strong> role.</p>
142
143<p>To enable access to the Manager web application, you must either create
144a new username/password combination and associate one of the
145<strong>manager-**</strong> roles with it, or add a
146<strong>manager-**</strong> role
147to some existing username/password combination.
148As the majority of this document describes the commands of plain textual
149interface, let the role name for further example to be
150<strong>manager-script</strong>.
151Exactly how the usernames/passwords are configured depends on which
152<code>Realm</code> implementation you are using:</p>
153<ul>
154<li><em>MemoryRealm</em> &mdash; This one is configured in the default
155 <code>$CATALINA_BASE/conf/server.xml</code>.
156 If you have not configured it differently, or replaced it with
157 a different <code>Realm</code> implementation, this realm
158 reads an XML-format file stored at
159 <code>$CATALINA_BASE/conf/tomcat-users.xml</code>, which can be
160 edited with any text editor. This file contains an XML
161 <code>&lt;user&gt;</code> for each individual user, which might
162 look something like this:
163<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
164&lt;user name="craigmcc" password="secret" roles="standard,manager-script" /&gt;
165</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
166 which defines the username and password used by this individual to
167 log on, and the role names he or she is associated with. You can
168 add the <strong>manager-script</strong> role to the comma-delimited
169 <code>roles</code> attribute for one or more existing users, and/or
170 create new users with that assigned role.</li>
171<li><em>JDBCRealm</em> &mdash; Your user and role information is stored in
172 a database accessed via JDBC. Add the <strong>manager-script</strong> role
173 to one or more existing users, and/or create one or more new users
174 with this role assigned, following the standard procedures for your
175 environment.</li>
176<li><em>JNDIRealm</em> &mdash; Your user and role information is stored in
177 a directory server accessed via LDAP. Add the
178 <strong>manager-script</strong> role to one or more existing users,
179 and/or create one or more new users with this role assigned, following
180 the standard procedures for your environment.</li>
181</ul>
182
183<p>The first time you attempt to issue one of the Manager commands
184described in the next section, you will be challenged to log on using
185BASIC authentication. The username and password you enter do not matter,
186as long as they identify a valid user in the users database who possesses
187the role <strong>manager-script</strong>.</p>
188
189<p>In addition to the password restrictions the Manager web application
190could be restricted by the <strong>remote IP address</strong> or host by adding
191a <code>RemoteAddrValve</code> or <code>RemoteHostValve</code>.
192See <a href="config/valve.html#Remote_Address_Filter">valves documentation</a>
193for details. Here is
194an example of restricting access to the localhost by IP address:</p>
195<pre>
196&lt;Context privileged="true"&gt;
197 &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
198 allow="127\.0\.0\.1"/&gt;
199&lt;/Context&gt;
200</pre>
201
202</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>
203
204<p>All commands that the Manager application knows how to process are
205specified in a single request URI like this:</p>
206<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
207http://{host}:{port}/manager/text/{command}?{parameters}
208</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
209<p>where <code>{host}</code> and <code>{port}</code> represent the hostname
210and port number on which Tomcat is running, <code>{command}</code>
211represents the Manager command you wish to execute, and
212<code>{parameters}</code> represents the query parameters
213that are specific to that command. In the illustrations below, customize
214the host and port appropriately for your installation.</p>
215
216<p>Most commands accept one or more of the following query parameters:</p>
217<ul>
218<li><strong>path</strong> - The context path (including the leading slash)
219 of the web application you are dealing with. To select the ROOT web
220 application, specify "/". <strong>NOTE</strong> -
221 It is not possible to perform administrative commands on the
222 Manager application itself.</li>
223<li><strong>version</strong> - The version of this web application as used by
224 the parallel deployment feature,</li>
225<li><strong>war</strong> - URL of a web application archive (WAR) file,
226 pathname of a directory which contains the web application, or a
227 Context configuration ".xml" file. You can use URLs in any of the
228 following formats:
229 <ul>
230 <li><strong>file:/absolute/path/to/a/directory</strong> - The absolute
231 path of a directory that contains the unpacked version of a web
232 application. This directory will be attached to the context path
233 you specify without any changes.</li>
234 <li><strong>file:/absolute/path/to/a/webapp.war</strong> - The absolute
235 path of a web application archive (WAR) file. This is valid
236 <strong>only</strong> for the <code>/deploy</code> command, and is
237 the only acceptable format to that command.</li>
238 <li><strong>jar:file:/absolute/path/to/a/warfile.war!/</strong> - The
239 URL to a local web application archive (WAR) file. You can use any
240 syntax that is valid for the <code>JarURLConnection</code> class
241 for reference to an entire JAR file.</li>
242 <li><strong>file:/absolute/path/to/a/context.xml</strong> - The
243 absolute path of a web application Context configuration ".xml"
244 file which contains the Context configuration element.</li>
245 <li><strong>directory</strong> - The directory name for the web
246 application context in the Host's application base directory.</li>
247 <li><strong>webapp.war</strong> - The name of a web application war file
248 located in the Host's application base directory.</li>
249 </ul></li>
250</ul>
251
252<p>Each command will return a response in <code>text/plain</code> format
253(i.e. plain ASCII with no HTML markup), making it easy for both humans and
254programs to read). The first line of the response will begin with either
255<code>OK</code> or <code>FAIL</code>, indicating whether the requested
256command was successful or not. In the case of failure, the rest of the first
257line will contain a description of the problem that was encountered. Some
258commands include additional lines of information as described below.</p>
259
260<p><em>Internationalization Note</em> - The Manager application looks up
261its message strings in resource bundles, so it is possible that the strings
262have been translated for your platform. The examples below show the English
263version of the messages.</p>
264
265<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploy A New Application Remotely"><!--()--></a><a name="Deploy_A_New_Application_Remotely"><strong>Deploy A New Application Remotely</strong></a></font></td></tr><tr><td><blockquote>
266
267<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
268http://localhost:8080/manager/text/deploy?path=/foo
269</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
270
271<p>Upload the web application archive (WAR) file that is specified as the
272request data in this HTTP PUT request, install it into the <code>appBase</code>
273directory of our corresponding virtual host, and start , using the directory
274name or the war file name without the .war extension as the path. The
275application can later be undeployed (and the corresponding application directory
276removed) by use of the <code>/undeploy</code> command.</p>
277
278<p>The .WAR file may include Tomcat specific deployment configuration, by
279including a Context configuration XML file in
280<code>/META-INF/context.xml</code>.</p>
281
282<p>URL parameters include:</p>
283<ul>
284<li><code>update</code>: When set to true, any existing update will be
285 undeployed first. The default value is set to false.</li>
286<li><code>tag</code>: Specifying a tag name, this allows associating the
287 deployed webapp with a tag or label. If the web application is undeployed,
288 it can be later redeployed when needed using only the tag.</li>
289</ul>
290
291<p><strong>NOTE</strong> - This command is the logical
292opposite of the <code>/undeploy</code> command.</p>
293
294<p>If installation and startup is successful, you will receive a response
295like this:</p>
296<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
297OK - Deployed application at context path /foo
298</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
299
300<p>Otherwise, the response will start with <code>FAIL</code> and include an
301error message. Possible causes for problems include:</p>
302<ul>
303<li><em>Application already exists at path /foo</em>
304 <blockquote>
305 <p>The context paths for all currently running web applications must be
306 unique. Therefore, you must undeploy the existing web
307 application using this context path, or choose a different context path
308 for the new one. The <code>update</code> parameter may be specified as
309 a parameter on the URL, with a value of <code>true</code> to avoid this
310 error. In that case, an undeploy will be performed on an existing
311 application before performing the deployment.</p>
312 </blockquote></li>
313<li><em>Encountered exception</em>
314 <blockquote>
315 <p>An exception was encountered trying to start the new web application.
316 Check the Tomcat logs for the details, but likely explanations include
317 problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
318 classes encountered when initializing application event listeners and
319 filters.</p>
320 </blockquote></li>
321</ul>
322
323</blockquote></td></tr></table>
324
325<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>
326
327<p>Deploy and start a new web application, attached to the specified context
328<code>path</code> (which must not be in use by any other web application).
329This command is the logical opposite of the <code>/undeploy</code> command.</p>
330
331<p>There are a number of different ways the deploy command can be used.</p>
332
333<h3>Deploy a previously deployed webapp</h3>
334
335<p>This can be used to deploy a previously deployed web application, which
336has been deployed using the <code>tag</code> attribute. Note that the work
337directory for the Manager webapp will contain the previously deployed WARs;
338removing it would make the deployment fail.</p>
339<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
340http://localhost:8080/manager/text/deploy?path=/footoo&amp;tag=footag
341</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
342
343
344<h3>Deploy a Directory or WAR by URL</h3>
345
346<p>Deploy a web application directory or ".war" file located on the Tomcat
347server. If no <code>path</code> is specified, the directory name or the war file
348name without the ".war" extension is used as the path. The <code>war</code>
349parameter specifies a URL (including the <code>file:</code> scheme) for either
350a directory or a web application archive (WAR) file. The supported syntax for
351a URL referring to a WAR file is described on the Javadocs page for the
352<code>java.net.JarURLConnection</code> class. Use only URLs that refer to
353the entire WAR file.</p>
354
355<p>In this example the web application located in the directory
356<code>/path/to/foo</code> on the Tomcat server is deployed as the
357web application context named <code>/footoo</code>.</p>
358<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
359http://localhost:8080/manager/text/deploy?path=/footoo&amp;war=file:/path/to/foo
360</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
361
362
363<p>In this example the ".war" file <code>/path/to/bar.war</code> on the
364Tomcat server is deployed as the web application context named
365<code>/bar</code>. Notice that there is no <code>path</code> parameter
366so the context path defaults to the name of the web application archive
367file without the ".war" extension.</p>
368<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
369http://localhost:8080/manager/text/deploy?war=jar:file:/path/to/bar.war!/
370</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
371
372
373<h3>Deploy a Directory or War from the Host appBase</h3>
374
375<p>Deploy a web application directory or ".war" file located in your Host
376appBase directory. The directory name or the war file name without the ".war"
377extension is used as the path.</p>
378
379<p>In this example the web application located in a sub directory named
380<code>foo</code> in the Host appBase directory of the Tomcat server is
381deployed as the web application context named <code>/foo</code>. Notice
382that the context path used is the name of the web application directory.</p>
383<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
384http://localhost:8080/manager/text/deploy?war=foo
385</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
386
387
388<p>In this example the ".war" file <code>bar.war</code> located in your
389Host appBase directory on the Tomcat server is deployed as the web
390application context named <code>/bar</code>.</p>
391<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
392http://localhost:8080/manager/text/deploy?war=bar.war
393</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
394
395
396<h3>Deploy using a Context configuration ".xml" file</h3>
397
398<p>If the Host deployXML flag is set to true you can deploy a web
399application using a Context configuration ".xml" file and an optional
400".war" file or web application directory. The context <code>path</code>
401is not used when deploying a web application using a context ".xml"
402configuration file.</p>
403
404<p>A Context configuration ".xml" file can contain valid XML for a
405web application Context just as if it were configured in your
406Tomcat <code>server.xml</code> configuration file. Here is an
407example:</p>
408<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
409&lt;Context path="/foobar" docBase="/path/to/application/foobar"&gt;
410&lt;/Context&gt;
411</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
412
413
414<p>When the optional <code>war</code> parameter is set to the URL
415for a web application ".war" file or directory it overrides any
416docBase configured in the context configuration ".xml" file.</p>
417
418<p>Here is an example of deploying an application using a Context
419configuration ".xml" file.</p>
420<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
421http://localhost:8080/manager/text/deploy?config=file:/path/context.xml
422</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
423
424
425<p>Here is an example of deploying an application using a Context
426configuration ".xml" file and a web application ".war" file located
427on the server.</p>
428<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
429http://localhost:8080/manager/text/deploy
430 ?config=file:/path/context.xml&amp;war=jar:file:/path/bar.war!/
431</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
432
433
434<h3>Deployment Notes</h3>
435
436<p>If the Host is configured with unpackWARs=true and you deploy a war
437file, the war will be unpacked into a directory in your Host appBase
438directory.</p>
439
440<p>If the application war or directory is installed in your Host appBase
441directory and either the Host is configured with autoDeploy=true or the
442Context path must match the directory name or war file name without the
443".war" extension.</p>
444
445<p>For security when untrusted users can manage web applications, the
446Host deployXML flag can be set to false. This prevents untrusted users
447from deploying web applications using a configuration XML file and
448also prevents them from deploying application directories or ".war"
449files located outside of their Host appBase.</p>
450
451
452<h3>Deploy Response</h3>
453
454<p>If installation and startup is successful, you will receive a response
455like this:</p>
456<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
457OK - Deployed application at context path /foo
458</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
459
460<p>Otherwise, the response will start with <code>FAIL</code> and include an
461error message. Possible causes for problems include:</p>
462<ul>
463<li><em>Application already exists at path /foo</em>
464 <blockquote>
465 <p>The context paths for all currently running web applications must be
466 unique. Therefore, you must undeploy the existing web
467 application using this context path, or choose a different context path
468 for the new one. The <code>update</code> parameter may be specified as
469 a parameter on the URL, with a value of <code>true</code> to avoid this
470 error. In that case, an undeploy will be performed on an existing
471 application before performing the deployment.</p>
472 </blockquote></li>
473<li><em>Document base does not exist or is not a readable directory</em>
474 <blockquote>
475 <p>The URL specified by the <code>war</code> parameter must identify a
476 directory on this server that contains the "unpacked" version of a
477 web application, or the absolute URL of a web application archive (WAR)
478 file that contains this application. Correct the value specified by
479 the <code>war</code> parameter.</p>
480 </blockquote></li>
481<li><em>Encountered exception</em>
482 <blockquote>
483 <p>An exception was encountered trying to start the new web application.
484 Check the Tomcat logs for the details, but likely explanations include
485 problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
486 classes encountered when initializing application event listeners and
487 filters.</p>
488 </blockquote></li>
489<li><em>Invalid application URL was specified</em>
490 <blockquote>
491 <p>The URL for the directory or web application that you specified
492 was not valid. Such URLs must start with <code>file:</code>, and URLs
493 for a WAR file must end in ".war".</p>
494 </blockquote></li>
495<li><em>Invalid context path was specified</em>
496 <blockquote>
497 <p>The context path must start with a slash character. To reference the
498 ROOT web application use "/".</p>
499 </blockquote></li>
500<li><em>Context path must match the directory or WAR file name:</em>
501 <blockquote>
502 If the application war or directory is installed in your Host appBase
503 directory and either the Host is configured with autoDeploy=true the
504 Context path must match the directory name or war file name without
505 the ".war" extension.
506 </blockquote></li>
507<li><em>Only web applications in the Host web application directory can
508 be installed</em>
509 <blockquote>
510 If the Host deployXML flag is set to false this error will happen
511 if an attempt is made to deploy a web application directory or
512 ".war" file outside of the Host appBase directory.
513 </blockquote></li>
514</ul>
515
516</blockquote></td></tr></table>
517
518<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>
519
520<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
521http://localhost:8080/manager/text/list
522</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
523
524<p>List the context paths, current status (<code>running</code> or
525<code>stopped</code>), and number of active sessions for all currently
526deployed web applications. A typical response immediately
527after starting Tomcat might look like this:</p>
528<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
529OK - Listed applications for virtual host localhost
530/webdav:running:0
531/examples:running:0
532/manager:running:0
533/:running:0
534</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
535
536</blockquote></td></tr></table>
537
538<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>
539
540<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
541http://localhost:8080/manager/text/reload?path=/examples
542</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
543
544<p>Signal an existing application to shut itself down and reload. This can
545be useful when the web application context is not reloadable and you have
546updated classes or property files in the <code>/WEB-INF/classes</code>
547directory or when you have added or updated jar files in the
548<code>/WEB-INF/lib</code> directory.
549</p>
550<p><strong>NOTE:</strong> The <code>/WEB-INF/web.xml</code>
551web application configuration file is not reread on a reload.
552If you have made changes to your web.xml file you must stop
553then start the web application.
554</p>
555
556<p>If this command succeeds, you will see a response like this:</p>
557<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
558OK - Reloaded application at context path /examples
559</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
560
561<p>Otherwise, the response will start with <code>FAIL</code> and include an
562error message. Possible causes for problems include:</p>
563<ul>
564<li><em>Encountered exception</em>
565 <blockquote>
566 <p>An exception was encountered trying to restart the web application.
567 Check the Tomcat logs for the details.</p>
568 </blockquote></li>
569<li><em>Invalid context path was specified</em>
570 <blockquote>
571 <p>The context path must start with a slash character. To reference the
572 ROOT web application use "/".</p>
573 </blockquote></li>
574<li><em>No context exists for path /foo</em>
575 <blockquote>
576 <p>There is no deployed application on the context path
577 that you specified.</p>
578 </blockquote></li>
579<li><em>No context path was specified</em>
580 <blockquote>
581 The <code>path</code> parameter is required.
582 </blockquote></li>
583<li><em>Reload not supported on WAR deployed at path /foo</em>
584 <blockquote>
585 Currently, application reloading (to pick up changes to the classes or
586 <code>web.xml</code> file) is not supported when a web application is
587 deployed directly from a WAR file. It only works when the web application
588 is deployed from an unpacked directory. If you are using a WAR file,
589 you should <code>undeploy</code> and then <code>deploy</code> or
590 <code>deploy</code> with the <code>update</code> parameter the
591 application again to pick up your changes.
592 </blockquote></li>
593</ul>
594
595</blockquote></td></tr></table>
596
597<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>
598
599<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
600http://localhost:8080/manager/text/serverinfo
601</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
602
603<p>Lists information about the Tomcat version, OS, and JVM properties.</p>
604
605<p>If an error occurs, the response will start with <code>FAIL</code> and
606include an error message. Possible causes for problems include:</p>
607<ul>
608<li><em>Encountered exception</em>
609 <blockquote>
610 <p>An exception was encountered trying to enumerate the system properties.
611 Check the Tomcat logs for the details.</p>
612 </blockquote></li>
613</ul>
614
615</blockquote></td></tr></table>
616
617<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>
618
619<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
620http://localhost:8080/manager/text/resources[?type=xxxxx]
621</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
622
623<p>List the global JNDI resources that are available for use in resource
624links for context configuration files. If you specify the <code>type</code>
625request parameter, the value must be the fully qualified Java class name of
626the resource type you are interested in (for example, you would specify
627<code>javax.sql.DataSource</code> to acquire the names of all available
628JDBC data sources). If you do not specify the <code>type</code> request
629parameter, resources of all types will be returned.</p>
630
631<p>Depending on whether the <code>type</code> request parameter is specified
632or not, the first line of a normal response will be:</p>
633<pre>
634 OK - Listed global resources of all types
635</pre>
636<p>or</p>
637<pre>
638 OK - Listed global resources of type xxxxx
639</pre>
640<p>followed by one line for each resource. Each line is composed of fields
641delimited by colon characters (":"), as follows:</p>
642<ul>
643<li><em>Global Resource Name</em> - The name of this global JNDI resource,
644 which would be used in the <code>global</code> attribute of a
645 <code>&lt;ResourceLink&gt;</code> element.</li>
646<li><em>Global Resource Type</em> - The fully qualified Java class name of
647 this global JNDI resource.</li>
648</ul>
649
650<p>If an error occurs, the response will start with <code>FAIL</code> and
651include an error message. Possible causes for problems include:</p>
652<ul>
653<li><em>Encountered exception</em>
654 <blockquote>
655 <p>An exception was encountered trying to enumerate the global JNDI
656 resources. Check the Tomcat logs for the details.</p>
657 </blockquote></li>
658<li><em>No global JNDI resources are available</em>
659 <blockquote>
660 <p>The Tomcat server you are running has been configured without
661 global JNDI resources.</p>
662 </blockquote></li>
663</ul>
664
665
666</blockquote></td></tr></table>
667
668<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>
669
670<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
671http://localhost:8080/manager/text/sessions?path=/examples
672</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
673
674<p>Display the default session timeout for a web application, and the
675number of currently active sessions that fall within ten-minute ranges of
676their actual timeout times. For example, after restarting Tomcat and then
677executing one of the JSP samples in the <code>/examples</code> web app,
678you might get something like this:</p>
679<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
680OK - Session information for application at context path /examples
681Default maximum session inactive interval 30 minutes
68230 - &lt;40 minutes:1 sessions
683</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
684
685</blockquote></td></tr></table>
686
687
688<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>
689
690<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
691http://localhost:8080/manager/text/start?path=/examples
692</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
693
694<p>Signal a stopped application to restart, and make itself available again.
695Stopping and starting is useful, for example, if the database required by
696your application becomes temporarily unavailable. It is usually better to
697stop the web application that relies on this database rather than letting
698users continuously encounter database exceptions.</p>
699
700<p>If this command succeeds, you will see a response like this:</p>
701<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
702OK - Started application at context path /examples
703</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
704
705<p>Otherwise, the response will start with <code>FAIL</code> and include an
706error message. Possible causes for problems include:</p>
707<ul>
708<li><em>Encountered exception</em>
709 <blockquote>
710 <p>An exception was encountered trying to start the web application.
711 Check the Tomcat logs for the details.</p>
712 </blockquote></li>
713<li><em>Invalid context path was specified</em>
714 <blockquote>
715 <p>The context path must start with a slash character. To reference the
716 ROOT web application use "/".</p>
717 </blockquote></li>
718<li><em>No context exists for path /foo</em>
719 <blockquote>
720 <p>There is no deployed application on the context path
721 that you specified.</p>
722 </blockquote></li>
723<li><em>No context path was specified</em>
724 <blockquote>
725 The <code>path</code> parameter is required.
726 </blockquote></li>
727</ul>
728
729</blockquote></td></tr></table>
730
731<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>
732
733<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
734http://localhost:8080/manager/text/stop?path=/examples
735</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
736
737<p>Signal an existing application to make itself unavailable, but leave it
738deployed. Any request that comes in while an application is
739stopped will see an HTTP error 404, and this application will show as
740"stopped" on a list applications command.</p>
741
742<p>If this command succeeds, you will see a response like this:</p>
743<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
744OK - Stopped application at context path /examples
745</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
746
747<p>Otherwise, the response will start with <code>FAIL</code> and include an
748error message. Possible causes for problems include:</p>
749<ul>
750<li><em>Encountered exception</em>
751 <blockquote>
752 <p>An exception was encountered trying to stop the web application.
753 Check the Tomcat logs for the details.</p>
754 </blockquote></li>
755<li><em>Invalid context path was specified</em>
756 <blockquote>
757 <p>The context path must start with a slash character. To reference the
758 ROOT web application use "/".</p>
759 </blockquote></li>
760<li><em>No context exists for path /foo</em>
761 <blockquote>
762 <p>There is no deployed application on the context path
763 that you specified.</p>
764 </blockquote></li>
765<li><em>No context path was specified</em>
766 <blockquote>
767 The <code>path</code> parameter is required.
768 </blockquote></li>
769</ul>
770
771</blockquote></td></tr></table>
772
773
774<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>
775
776<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
777http://localhost:8080/manager/text/undeploy?path=/examples
778</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
779
780<p><strong><font color="red">WARNING</font> - This command will delete any web
781application artifacts that exist within <code>appBase</code> directory
782(typically "webapps") for this virtual host</strong>.
783This will delete the the application .WAR, if present,
784the application directory resulting either from a deploy in unpacked form
785or from .WAR expansion as well as the XML Context definition from
786<code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> directory.
787If you simply want to take an application
788out of service, you should use the <code>/stop</code> command instead.</p>
789
790<p>Signal an existing application to gracefully shut itself down, and
791remove it from Tomcat (which also makes this context path available for
792reuse later). In addition, the document root directory is removed, if it
793exists in the <code>appBase</code> directory (typically "webapps") for
794this virtual host. This command is the logical opposite of the
795<code>/deploy</code> command.</p>
796
797<p>If this command succeeds, you will see a response like this:</p>
798<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
799OK - Undeployed application at context path /examples
800</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
801
802<p>Otherwise, the response will start with <code>FAIL</code> and include an
803error message. Possible causes for problems include:</p>
804<ul>
805<li><em>Encountered exception</em>
806 <blockquote>
807 <p>An exception was encountered trying to undeploy the web application.
808 Check the Tomcat logs for the details.</p>
809 </blockquote></li>
810<li><em>Invalid context path was specified</em>
811 <blockquote>
812 <p>The context path must start with a slash character. To reference the
813 ROOT web application use "/".</p>
814 </blockquote></li>
815<li><em>No context exists for path /foo</em>
816 <blockquote>
817 <p>There is no deployed application on the context path
818 that you specified.</p>
819 </blockquote></li>
820<li><em>No context path was specified</em>
821 <blockquote>
822 The <code>path</code> parameter is required.
823 </blockquote></li>
824</ul>
825
826</blockquote></td></tr></table>
827
828<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>
829
830<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
831http://localhost:8080/manager/text/findleaks[?statusLine=[true|false]]
832</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
833
834<p><strong>The find leaks diagnostic triggers a full garbage collection. It
835should be used with extreme caution on production systems.</strong></p>
836
837<p>The find leaks diagnostic attempts to identify web applications that have
838caused memory leaks when they were stopped, reloaded or undeployed. Results
839should always be confirmed
840with a profiler. The diagnostic uses additional functionality provided by the
841StandardHost implementation. It will not work if a custom host is used that
842does not extend StandardHost.</p>
843
844<p>Explicitly triggering a full garbage collection from Java code is documented
845to be unreliable. Furthermore, depending on the JVM used, there are options to
846disable explicit GC triggering, like <code>-XX:+DisableExplicitGC</code>.
847If you want to make sure, that the diagnostics were successfully running a full
848GC, you will need to check using tools like GC logging, JConsole or similar.</p>
849
850<p>If this command succeeds, you will see a response like this:</p>
851<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
852/leaking-webapp
853</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
854
855<p>If you wish to see a status line included in the response then include the
856<code>statusLine</code> query parameter in the request with a value of
857<code>true</code>.</p>
858
859<p>Each context path for a web application that was stopped, reloaded or
860undeployed, but which classes from the previous runs are still loaded in memory,
861thus causing a memory leak, will be listed on a new line. If an application
862has been reloaded several times, it may be listed several times.</p>
863
864<p>If the command does not succeed, the response will start with
865<code>FAIL</code> and include an error message.</p>
866
867</blockquote></td></tr></table>
868
869<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><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>
870
871<p>From this link , you can view information about the server.</p>
872
873<p>First, you have the server and JVM version number, JVM provider, OS name
874and number followed by the architecture type.</p>
875
876<p>Second, there is several information about the memory usage of the JVM
877(available, total and max memory).</p>
878
879<p>Then, there is information about the Tomcat AJP and HTTP connectors.
880The same information is available for both of them :
881</p>
882<ul>
883 <li><p>Threads information : Max threads, min and max spare threads,
884 current thread count and current thread busy.</p></li>
885 <li><p>Request information : Max processing time and processing time,
886 request and error count, bytes received and sent.</p></li>
887 <li><p>A table showing Stage, Time, Bytes Sent, Bytes Receive, Client,
888 VHost and Request. All existing threads are listed in the table.
889 Here is the list of the possible thread stages :</p>
890 <ul>
891 <li><p><em>"Parse and Prepare Request"</em> : The request headers are
892 being parsed or the necessary preparation to read the request body (if
893 a transfer encoding has been specified) is taking place.</p></li>
894 <li><p><em>"Service"</em> : The thread is processing a request and
895 generating the response. This stage follows the "Parse and Prepare
896 Request" stage and precedes the "Finishing" stage. There is always at
897 least one thread in this stage (the server-status page).</p></li>
898 <li><p><em>"Finishing"</em> : The end of the request processing. Any
899 remainder of the response still in the output buffers is sent to the
900 client. This stage is followed by "Keep-Alive" if it is appropriate to
901 keep the connection alive or "Ready" if "Keep-Alive" is not
902 appropriate.</p></li>
903 <li><p><em>"Keep-Alive"</em> : The thread keeps the connection open to
904 the client in case the client sends another request. If another request
905 is received, the next stage will br "Parse and Prepare Requst". If no
906 request is received before the keep alive times out, the connection will
907 be closed and the next stage will be "Ready".</p></li>
908 <li><p><em>"Ready"</em> : The thread is at rest and ready to be
909 used.</p></li>
910 </ul>
911 </li>
912</ul>
913</blockquote></td></tr></table>
914
915</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>
916
917<p>In addition to the ability to execute Manager commands via HTTP requests,
918as documented above, Tomcat includes a convenient set of Task definitions
919for the <em>Ant</em> (version 1.4 or later) build tool. In order to use these
920commands, you must perform the following setup operations:</p>
921<ul>
922<li>Download the binary distribution of Ant from
923 <a href="http://ant.apache.org">http://ant.apache.org</a>.
924 You must use version <strong>1.4</strong> or later.</li>
925<li>Install the Ant distribution in a convenient directory (called
926 ANT_HOME in the remainder of these instructions).</li>
927<li>Copy the file <code>server/lib/catalina-ant.jar</code> from your Tomcat
928 installation into Ant's library directory (<code>$ANT_HOME/lib</code>).
929 </li>
930<li>Add the <code>$ANT_HOME/bin</code> directory to your <code>PATH</code>
931 environment variable.</li>
932<li>Configure at least one username/password combination in your Tomcat
933 user database that includes the <code>manager-script</code> role.</li>
934</ul>
935
936<p>To use custom tasks within Ant, you must declare them first with a
937<code>&lt;taskdef&gt;</code> element. Therefore, your <code>build.xml</code>
938file might look something like this:</p>
939
940<table border="1">
941<tr><td><pre>
942&lt;project name="My Application" default="compile" basedir="."&gt;
943
944 &lt;!-- Configure the directory into which the web application is built --&gt;
945 &lt;property name="build" value="${basedir}/build"/&gt;
946
947 &lt;!-- Configure the context path for this application --&gt;
948 &lt;property name="path" value="/myapp"/&gt;
949
950 &lt;!-- Configure properties to access the Manager application --&gt;
951 &lt;property name="url" value="http://localhost:8080/manager/text"/&gt;
952 &lt;property name="username" value="myusername"/&gt;
953 &lt;property name="password" value="mypassword"/&gt;
954
955 &lt;!-- Configure the custom Ant tasks for the Manager application --&gt;
956 &lt;taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/&gt;
957 &lt;taskdef name="list" classname="org.apache.catalina.ant.ListTask"/&gt;
958 &lt;taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/&gt;
959 &lt;taskdef name="findleaks" classname="org.apache.catalina.ant.FindLeaksTask"/&gt;
960 &lt;taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/&gt;
961 &lt;taskdef name="start" classname="org.apache.catalina.ant.StartTask"/&gt;
962 &lt;taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/&gt;
963 &lt;taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/&gt;
964
965 &lt;!-- Executable Targets --&gt;
966 &lt;target name="compile" description="Compile web application"&gt;
967 &lt;!-- ... construct web application in ${build} subdirectory, and
968 generated a ${path}.war ... --&gt;
969 &lt;/target&gt;
970
971 &lt;target name="deploy" description="Install web application"
972 depends="compile"&gt;
973 &lt;deploy url="${url}" username="${username}" password="${password}"
974 path="${path}" war="file:${build}${path}.war"/&gt;
975 &lt;/target&gt;
976
977 &lt;target name="reload" description="Reload web application"
978 depends="compile"&gt;
979 &lt;reload url="${url}" username="${username}" password="${password}"
980 path="${path}"/&gt;
981 &lt;/target&gt;
982
983 &lt;target name="undeploy" description="Remove web application"&gt;
984 &lt;undeploy url="${url}" username="${username}" password="${password}"
985 path="${path}"/&gt;
986 &lt;/target&gt;
987
988&lt;/project&gt;
989</pre></td></tr>
990</table>
991
992<p>Note: The definition of the resources task above will override the resources
993datatype added in Ant 1.7. If you wish to use the resources datatype you will
994need to use Ant's namespace support to assign the Tomcat tasks to their own
995namespace.</p>
996
997<p>Now, you can execute commands like <code>ant deploy</code> to deploy the
998application to a running instance of Tomcat, or <code>ant reload</code> to
999tell Tomcat to reload it. Note also that most of the interesting values in
1000this <code>build.xml</code> file are defined as replaceable properties, so
1001you can override their values from the command line. For example, you might
1002consider it a security risk to include the real manager password in your
1003<code>build.xml</code> file's source code. To avoid this, omit the password
1004property, and specify it from the command line:</p>
1005<pre>
1006 ant -Dpassword=secret deploy
1007</pre>
1008
1009<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>
1010
1011<p>Using <em>Ant</em> version <strong>1.6.2</strong> or later,
1012the Catalina tasks offer the option to capture their output in
1013properties or external files. They support directly the following subset of the
1014<code>&lt;redirector&gt;</code> type attributes:
1015</p>
1016
1017<table border="1" cellpadding="2" cellspacing="0">
1018<tbody>
1019<tr>
1020<td valign="top"><b>Attribute</b></td>
1021<td valign="top"><b>Description</b></td>
1022<td align="center" valign="top"><b>Required</b></td>
1023</tr>
1024<tr>
1025<td valign="top">output</td>
1026<td valign="top">Name of a file to which to write the output. If
1027the error stream is not also redirected to a file or property, it will
1028appear in this output.</td>
1029<td align="center" valign="top">No</td>
1030</tr>
1031<tr>
1032<td valign="top">error</td>
1033<td valign="top">The file to which the standard error of the
1034command should be redirected.</td>
1035<td align="center" valign="top">No</td>
1036</tr>
1037<tr>
1038<td valign="top">logError</td>
1039<td valign="top">This attribute is used when you wish to see
1040error output in Ant's log and you are redirecting output to a
1041file/property. The error output will not be included in the output
1042file/property. If you redirect error with the <i>error</i> or <i>errorProperty</i>
1043attributes, this will have no effect.</td>
1044<td align="center" valign="top">No</td>
1045</tr>
1046<tr>
1047<td valign="top">append</td>
1048<td valign="top">Whether output and error files should be
1049appended to or overwritten. Defaults to <code>false</code>.</td>
1050<td align="center" valign="top">No</td>
1051</tr>
1052<tr>
1053<td valign="top">createemptyfiles</td>
1054<td valign="top">Whether output and error files should be created
1055even when empty. Defaults to <code>true</code>.</td>
1056<td align="center" valign="top">No</td>
1057</tr>
1058<tr>
1059<td valign="top">outputproperty</td>
1060<td valign="top">The name of a property in which the output of
1061the command should be stored. Unless the error stream is redirected to
1062a separate file or stream, this property will include the error output.</td>
1063<td align="center" valign="top">No</td>
1064</tr>
1065<tr>
1066<td valign="top">errorproperty</td>
1067<td valign="top">The name of a property in which the standard
1068error of the command should be stored.</td>
1069<td align="center" valign="top">No</td>
1070</tr>
1071</tbody>
1072</table>
1073
1074<p>A couple of additional attributes can also be specified:
1075</p>
1076<table border="1" cellpadding="2" cellspacing="0">
1077<tbody>
1078<tr>
1079<td valign="top"><b>Attribute</b></td>
1080<td valign="top"><b>Description</b></td>
1081<td align="center" valign="top"><b>Required</b></td>
1082</tr>
1083<tr>
1084<td valign="top">alwaysLog</td>
1085<td valign="top">This attribute is used when you wish to see the
1086output you are capturing, appearing also in the Ant's log. It must not be
1087used unless you are capturing task output.
1088Defaults to <code>false</code>.
1089<em>This attribute will be supported directly by <code>&lt;redirector&gt;</code>
1090in Ant 1.6.3</em></td>
1091<td align="center" valign="top">No</td>
1092</tr>
1093<tr>
1094<td valign="top">failonerror</td>
1095<td valign="top">This attribute is used when you wish to avoid that
1096any manager command processing error terminates the ant execution. Defaults to <code>true</code>.
1097It must be set to <code>false</code>, if you want to capture error output,
1098otherwise execution will terminate before anything can be captured.
1099<br>
1100This attribute acts only on manager command execution,
1101any wrong or missing command attribute will still cause Ant execution termination.
1102</td>
1103<td align="center" valign="top">No</td>
1104</tr>
1105</tbody>
1106</table>
1107
1108<p>They also support the embedded <code>&lt;redirector&gt;</code> element
1109in which you can specify
1110its full set of attributes, but <code>input</code>, <code>inputstring</code> and
1111<code>inputencoding</code> that, even if accepted, are not used because they have
1112no meaning in this context.
1113Refer to <a href="http://ant.apache.org">ant manual</a> for details on
1114<code>&lt;redirector&gt;</code> element attributes.
1115</p>
1116
1117<p>
1118Here is a sample build file extract that shows how this output redirection support
1119can be used:
1120</p>
1121
1122<table border="1">
1123<tr><td><pre>
1124 &lt;target name="manager.deploy"
1125 depends="context.status"
1126 if="context.notInstalled"&gt;
1127 &lt;deploy url="${mgr.url}"
1128 username="${mgr.username}"
1129 password="${mgr.password}"
1130 path="${mgr.context.path}"
1131 config="${mgr.context.descriptor}"/&gt;
1132 &lt;/target&gt;
1133
1134 &lt;target name="manager.deploy.war"
1135 depends="context.status"
1136 if="context.deployable"&gt;
1137 &lt;deploy url="${mgr.url}"
1138 username="${mgr.username}"
1139 password="${mgr.password}"
1140 update="${mgr.update}"
1141 path="${mgr.context.path}"
1142 war="${mgr.war.file}"/&gt;
1143 &lt;/target&gt;
1144
1145 &lt;target name="context.status"&gt;
1146 &lt;property name="running" value="${mgr.context.path}:running"/&gt;
1147 &lt;property name="stopped" value="${mgr.context.path}:stopped"/&gt;
1148
1149 &lt;list url="${mgr.url}"
1150 outputproperty="ctx.status"
1151 username="${mgr.username}"
1152 password="${mgr.password}"&gt;
1153 &lt;/list&gt;
1154
1155 &lt;condition property="context.running"&gt;
1156 &lt;contains string="${ctx.status}" substring="${running}"/&gt;
1157 &lt;/condition&gt;
1158 &lt;condition property="context.stopped"&gt;
1159 &lt;contains string="${ctx.status}" substring="${stopped}"/&gt;
1160 &lt;/condition&gt;
1161 &lt;condition property="context.notInstalled"&gt;
1162 &lt;and&gt;
1163 &lt;isfalse value="${context.running}"/&gt;
1164 &lt;isfalse value="${context.stopped}"/&gt;
1165 &lt;/and&gt;
1166 &lt;/condition&gt;
1167 &lt;condition property="context.deployable"&gt;
1168 &lt;or&gt;
1169 &lt;istrue value="${context.notInstalled}"/&gt;
1170 &lt;and&gt;
1171 &lt;istrue value="${context.running}"/&gt;
1172 &lt;istrue value="${mgr.update}"/&gt;
1173 &lt;/and&gt;
1174 &lt;and&gt;
1175 &lt;istrue value="${context.stopped}"/&gt;
1176 &lt;istrue value="${mgr.update}"/&gt;
1177 &lt;/and&gt;
1178 &lt;/or&gt;
1179 &lt;/condition&gt;
1180 &lt;condition property="context.undeployable"&gt;
1181 &lt;or&gt;
1182 &lt;istrue value="${context.running}"/&gt;
1183 &lt;istrue value="${context.stopped}"/&gt;
1184 &lt;/or&gt;
1185 &lt;/condition&gt;
1186 &lt;/target&gt;
1187</pre></td></tr>
1188</table>
1189
1190<p><strong>WARNING:</strong> even if it doesn't make many sense, and is always a bad idea,
1191calling a Catalina task more than once,
1192badly set Ant tasks depends chains may cause that a task be called
1193more than once in the same Ant run, even if not intended to. A bit of caution should be exercised when you are
1194capturing output from that task, because this could lead to something unexpected:</p>
1195<ul>
1196<li>when capturing in a property you will find in it only the output from the <em>first</em> call, because
1197Ant properties are immutable and once set they cannot be changed,
1198</li>
1199<li>when capturing in a file, each run will overwrite it and you will find in it only the <em>last</em> call
1200output, unless you are using the <code>append="true"</code> attribute, in which case you will
1201see the output of each task call appended to the file.
1202</li>
1203</ul>
1204
1205</blockquote></td></tr></table>
1206
1207</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>
1208
1209 <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>
1210 The JMX Proxy Servlet is a lightweight proxy to get and set the
1211 tomcat internals. (Or any class that has been exposed via an MBean)
1212 Its usage is not very user friendly but the UI is
1213 extremely help for integrating command line scripts for monitoring
1214 and changing the internals of tomcat. You can do two things with the proxy:
1215 get information and set information. For you to really understand the
1216 JMX Proxy Servlet, you should have a general understanding of JMX.
1217 If you don't know what JMX is, then prepare to be confused.
1218 </blockquote></td></tr></table>
1219
1220 <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>
1221 This takes the form:
1222<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1223http://webserver/manager/jmxproxy/?qry=STUFF
1224</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1225 Where <code>STUFF</code> is the JMX query you wish to perform. For example,
1226 here are some queries you might wish to run:
1227 <ul>
1228 <li>
1229 <code>qry=*%3Atype%3DRequestProcessor%2C* --&gt;
1230 type=RequestProcessor</code> which will locate all
1231 workers which can process requests and report
1232 their state.
1233 </li>
1234 <li>
1235 <code>qry=*%3Aj2eeType=Servlet%2c* --&gt;
1236 j2eeType=Servlet</code> which return all loaded servlets.
1237 </li>
1238 <li>
1239 <code>qry=Catalina%3Atype%3DEnvironment%2Cresourcetype%3DGlobal%2Cname%3DsimpleValue --&gt;
1240 Catalina:type=Environment,resourcetype=Global,name=simpleValue</code>
1241 which look for a specific MBean by the given name.
1242 </li>
1243 </ul>
1244 You'll need to experiment with this to really understand its capabilites.
1245 If you provide no <code>qry</code> parameter, then all of the MBeans will
1246 be displayed. We really recommend looking at the tomcat source code and
1247 understand the JMX spec to get a better understanding of all the queries
1248 you may run.
1249 </blockquote></td></tr></table>
1250
1251 <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>
1252 The JXMProxyServlet also supports a "get" command that you can use to
1253 fetch the value of a specific MBean's attribute. The general form of
1254 the <code>get</code> command is:
1255
1256<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1257http://webserver/manager/jmxproxy/?get=BEANNAME&amp;att=MYATTRIBUTE&amp;key=MYKEY
1258</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1259
1260 You must provide the following parameters:
1261 <ol>
1262 <li><code>get</code>: The full bean name</li>
1263 <li><code>att</code>: The attribute you wish to fetch</li>
1264 <li><code>key</code>: (optional) The key into a CompositeData MBean attribute</li>
1265 </ol>
1266
1267 If all goes well, then it will say OK, otherwise an error message will
1268 be shown. For example, let's say we wish to fetch the current heap memory
1269 data:
1270
1271<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1272http://webserver/manager/jmxproxy/?get=java.lang:type=Memory&amp;att=HeapMemoryUsage
1273</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1274
1275 Or, if you only want the "used" key:
1276
1277<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1278http://webserver/manager/jmxproxy/
1279 ?get=java.lang:type=Memory&amp;att=HeapMemoryUsage&amp;key=used
1280</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1281 </blockquote></td></tr></table>
1282
1283 <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>
1284 Now that you can query an MBean, its time to muck with Tomcat's internals!
1285 The general form of the set command is :
1286<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1287http://webserver/manager/jmxproxy/?set=BEANNAME&amp;att=MYATTRIBUTE&amp;val=NEWVALUE
1288</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1289 So you need to provide 3 request parameters:
1290 <ol>
1291 <li><code>set</code>: The full bean name</li>
1292 <li><code>att</code>: The attribute you wish to alter</li>
1293 <li><code>val</code>: The new value </li>
1294 </ol>
1295 If all goes ok, then it will say OK, otherwise an error message will be
1296 shown. For example, lets say we wish to turn up debugging on the fly for the
1297 <code>ErrorReportValve</code>. The following will set debugging to 10.
1298<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1299http://localhost:8080/manager/jmxproxy/
1300 ?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost
1301 &amp;att=debug&amp;val=10
1302</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1303 and my result is (YMMV):
1304<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1305Result: ok
1306</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1307
1308 Here is what I see if I pass in a bad value. Here is the URL I used,
1309 I try set debugging equal to 'cow':
1310<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1311http://localhost:8080/manager/jmxproxy/
1312 ?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost
1313 &amp;att=debug&amp;val=cow
1314</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1315 When I try that, my result is
1316<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1317Error: java.lang.NumberFormatException: For input string: "cow"
1318</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1319 </blockquote></td></tr></table>
1320
1321 <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>
1322 <p>The <code>invoke</code> command enables methods to be called on MBeans. The
1323 general form of the command is:</p>
1324<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1325http://webserver/manager/jmxproxy/
1326 ?invoke=BEANNAME&amp;op=METHODNAME&amp;ps=COMMASEPARATEDPARAMETERS
1327</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1328 <p>For example, to call the <code>findConnectors()</code> method of the
1329 <strong>Service</strong> use:</p>
1330<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
1331http://localhost:8080/manager/jmxproxy/
1332 ?invoke=Catalina%3Atype%3DService&amp;op=findConnectors&amp;ps=
1333</pre></td><td bgcolor="#023264" width="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="./images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
1334 </blockquote></td></tr></table>
1335
1336</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
1337 on improving documentation for Apache Tomcat.<br><br>
1338 If you have trouble and need help, read
1339 <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
1340 and ask your question on the tomcat-users
1341 <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
1342 Do not ask such questions here. This is not a Q&amp;A section.<br><br>
1343 The Apache Comments System is explained <a href="/tomcat-7.0-doc/comments.html">here</a>.
1344 Comments may be removed by our moderators if they are either
1345 implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
1346 var comments_shortname = 'tomcat';
1347 var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html';
1348 (function(w, d) {
1349 if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
1350 d.write('<div id="comments_thread"><\/div>');
1351 var s = d.createElement('script');
1352 s.type = 'text/javascript';
1353 s.async = true;
1354 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
1355 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
1356 }
1357 else {
1358 d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
1359 }
1360 })(window, document);
1361 //--><!]]></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>
1362 Copyright &copy; 1999-2013, Apache Software Foundation
1363 </em></font></div></td></tr></table></body></html>