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