Dictionary/tomcat/server/webapps/manager/manager-howto.html

1064 lines
No EOL
87 KiB
HTML

<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>The Apache Jakarta Tomcat 5 Servlet/JSP Container - Manager App HOW-TO</title><meta value="Craig R. McClanahan" name="author"><meta value="craigmcc@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="4" width="100%" border="0"><!--PAGE HEADER--><tr><td colspan="2"><!--JAKARTA LOGO--><a href="http://jakarta.apache.org/"><img border="0" alt="The Jakarta Project" align="left" src="./images/jakarta-logo.gif"></a><!--PROJECT LOGO--><a href="http://jakarta.apache.org/tomcat/"><img border="0" alt="
The Apache Jakarta Tomcat Servlet/JSP Container
" align="right" src="./images/tomcat.gif"></a></td></tr><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade="noshade"></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td nowrap="true" valign="top" align="left"><h1>The Apache Jakarta Tomcat 5 Servlet/JSP Container</h1><h2>Manager App HOW-TO</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Table of Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
<p>
Introduction<br>
Configuring Manager Application Access<br>
Supported Manager Commands<br>
<blockquote>
Deploy A New Application Remotely<br>
Deploy A New Application from a Local Path<br>
List Currently Deployed and Installed Applications<br>
Reload An Existing Application<br>
List OS and JVM Properties<br>
List Available Global JNDI Resources<br>
List Available Security Roles<br>
Session Statistics<br>
Start an Existing Application<br>
Stop an Existing Application<br>
Undeploy an Existing Application<br>
</blockquote>
Executing Manager Commands With Ant<br>
Using the JMX Proxy Servlet<br>
<blockquote>
What is JMX Proxy Servlet?<br>
Query command<br>
Set command<br>
</blockquote>
</p>
</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
<p>In many production environments, it is very useful to have the capability
to deploy a new web application, or undeploy an existing one, without having
to shut down and restart the entire container. In addition, you can request
an existing application to reload itself, even if you have not declared it
to be <code>reloadable</code> in the Tomcat 5 server
configuration file.</p>
<p>To support these capabilities, Tomcat 5 includes a web application
(installed by default on context path <code>/manager</code>) that supports
the following functions:</p>
<ul>
<li>Deploy a new web application, on a specified context path, from
the uploaded contents of a WAR file.</li>
<li>Install a new web application, which can be anywhere on the
server's disks.</li>
<li>List the currently deployed web applications, as well as the
sessions that are currently active for those web apps.</li>
<li>Reload an existing web application, to reflect changes in the
contents of <code>/WEB-INF/classes</code> or <code>/WEB-INF/lib</code>.
</li>
<li>List the OS and JVM property values.</li>
<li>List the available global JNDI resources, for use in deployment
tools that are preparing <code>&lt;ResourceLink&gt;</code> elements
nested in a <code>&lt;Context&gt;</code> deployment description.</li>
<li>List the available security roles defined in the user database.</li>
<li>Remove an installed web application.</li>
<li>Start a stopped application (thus making it available again).</li>
<li>Stop an existing application (so that it becomes unavailable), but
do not undeploy it.</li>
<li>Undeploy a deployed web application and delete its document base
directory.</li>
</ul>
<p>There are two ways to configure the Manager web application
<code>Context</code>:
<ul>
<li>Install the <code>manager.xml</code> context configuration file
in the <code>$CATALINA_HOME/conf/[enginename]/[hostname]</code> folder.
</li>
<li>Configure the Manager <code>Context</code> within the
<code>Host</code> configuration in your Tomcat <code>server.xml</code>
configuration. Here is an example:
<pre>
&lt;Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/kinetic/tomcat5/server/webapps/manager"&gt;
&lt;/Context&gt;
</pre>
</li>
</ul>
</p>
<p>If you have Tomcat configured to support multiple virtual hosts
(websites) you would need to configure a Manager for each.</p>
<p>There are three ways to use the <code>Manager</code> web application.
<ul>
<li>As an application with a user interface you use in your browser.
Here is an example URL where you can replace <code>localhost</code> with
your website host name: <code>http://localhost/manager/html/</code> .</li>
<li>A minimal version using HTTP requests only which is suitable for use
by scripts setup by system administrators. Commands are given as part of the
request URI, and responses are in the form of simple text that can be easily
parsed and processed. See
Supported Manager Commands for more information.</li>
<li>A convenient set of task definitions for the <em>Ant</em>
(version 1.4 or later) build tool. See
Executing Manager Commands
With Ant for more information.</li>
</ul>
</p>
<p>Future versions of Tomcat 5 will include administrative functionality that
is presented in (at least) the following forms:
<ul>
<li>As web services, so that Tomcat administration can be easily integrated
into remote and/or non-Java mnagement environments.</li>
<li>As a web application with a nice user interface (built on top of the
web services processing layer) for easy Tomcat administration via a
web browser.</li>
</ul>
</p>
</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Configuring Manager Application Access"><strong>Configuring Manager Application Access</strong></a></font></td></tr><tr><td><blockquote>
<blockquote><em>
<p>The description below uses the variable name $CATALINA_HOME
to refer to the directory into which you have installed Tomcat 5,
and is the base directory against which most relative paths are
resolved. However, if you have configured Tomcat 5 for multiple
instances by setting a CATALINA_BASE directory, you should use
$CATALINA_BASE instead of $CATALINA_HOME for each of these
references.</p>
</em></blockquote>
<p>It would be quite unsafe to ship Tomcat with default settings that allowed
anyone on the Internet to execute the Manager application on your server.
Therefore, the Manager application is shipped with the requirement that anyone
who attempts to use it must authenticate themselves, using a username and
password that have the role <strong>manager</strong> associated with them.
Further, there is no username in the default users file
(<conf>$CATALINA_HOME/conf/tomcat-users.xml</conf>) that is assigned this
role. Therefore, access to the Manager application is completely disabled
by default.</p>
<p>To enable access to the Manager web application, you must either create
a new username/password combination and associate the role name
<strong>manager</strong> with it, or add the <strong>manager</strong> role
to some existing username/password combination. Exactly where this is done
depends on which <code>Realm</code> implementation you are using:</p>
<ul>
<li><em>MemoryRealm</em> - If you have not customized your
<code>$CATALINA_HOME/conf/server.xml</code> to select a different one,
Tomcat 5 defaults to an XML-format file stored at
<code>$CATALINA_HOME/conf/tomcat-users.xml</code>, which can be
edited with any text editor. This file contains an XML
<code>&lt;user&gt;</code> for each individual user, which might
look something like this:
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
&lt;user name="craigmcc" password="secret" roles="standard,manager" /&gt;
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
which defines the username and password used by this individual to
log on, and the role names he or she is associated with. You can
add the <strong>manager</strong> role to the comma-delimited
<code>roles</code> attribute for one or more existing users, and/or
create new users with that assigned role.</li>
<li><em>JDBCRealm</em> - Your user and role information is stored in
a database accessed via JDBC. Add the <strong>manager</strong> role
to one or more existing users, and/or create one or more new users
with this role assigned, following the standard procedures for your
environment.</li>
<li><em>JNDIRealm</em> - Your user and role information is stored in
a directory server accessed via LDAP. Add the <strong>manager</strong>
role to one or more existing users, and/or create one or more new users
with this role assigned, following the standard procedures for your
environment.</li>
</ul>
<p>The first time you attempt to issue one of the Manager commands
described in the next section, you will be challenged to log on using
BASIC authentication. The username and password you enter do not matter,
as long as they identify a valid user in the users database who possesses
the role <strong>manager</strong>.</p>
<p>In addition to the password restrictions the manager web application
could be restricted by the remote IP address or host by adding a
<code>RemoteAddrValve</code> or <code>RemoteHostValve</code>. Here is
an example of restricting access to the localhost by IP address:
<pre>
&lt;Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/kinetic/tomcat5/server/webapps/manager"&gt;
&lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127.0.0.1"/&gt;
&lt;/Context&gt;
</pre>
</p>
</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Supported Manager Commands"><strong>Supported Manager Commands</strong></a></font></td></tr><tr><td><blockquote>
<p>All commands that the Manager application knows how to process are
specified in a single request URI like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://{host}:{port}/manager/{command}?{parameters}
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>where <code>{host}</code> and <code>{port}</code> represent the hostname
and port number on which Tomcat is running, <code>{command}</code>
represents the Manager command you wish to execute, and
<code>{parameters}</code> represents the query parameters
that are specific to that command. In the illustrations below, customize
the host and port appropriately for your installation.</p>
<p>Most commands accept one or more of the following query parameters:</p>
<ul>
<li><strong>path</strong> - The context path (including the leading slash)
of the web application you are dealing with. To select the ROOT web
application, specify a zero-length string. <strong>NOTE</strong> -
It is not possible to perform administrative commands on the
Manager application itself.</li>
<li><strong>war</strong> - URL of a web application archive (WAR) file,
pathname of a directory which contains the web application, or a
Context configuration ".xml" file. You can use URLs in any of the
following formats:
<ul>
<li><strong>file:/absolute/path/to/a/directory</strong> - The absolute
path of a directory that contains the unpacked version of a web
application. This directory will be attached to the context path
you specify without any changes.</li>
<li><strong>file:/absolute/path/to/a/webapp.war</strong> - The absolute
path of a web application archive (WAR) file. This is valid
<strong>only</strong> for the <code>/deploy</code> command, and is
the only acceptable format to that command.</li>
<li><strong>jar:file:/absolute/path/to/a/warfile.war!/</strong> - The
URL to a local web application archive (WAR) file. You can use any
syntax that is valid for the <code>JarURLConnection</code> class
for reference to an entire JAR file.</li>
<li><strong>file:/absolute/path/to/a/context.xml</strong> - The
absolute path of a web application Context configuration ".xml"
file which contains the Context configuration element.</li>
<li><strong>directory</strong> - The directory name for the web
applciation context in the Host's application base directory.</li>
<li><strong>webapp.war</strong> - The name of a web application war file
located in the Host's application base directory.</li>
</ul></li>
</ul>
<p>Each command will return a response in <code>text/plain</code> format
(i.e. plain ASCII with no HTML markup), making it easy for both humans and
programs to read). The first line of the response wil begin with either
<code>OK</code> or <code>FAIL</code>, indicating whether the requested
command was successful or not. In the case of failure, the rest of the first
line will contain a description of the problem that was encountered. Some
commands include additional lines of information as described below.</p>
<p><em>Internationalization Note</em> - The Manager application looks up
its message strings in resource bundles, so it is possible that the strings
have been translated for your platform. The examples below show the English
version of the messages.</p>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Deploy A New Application Remotely"><strong>Deploy A New Application Remotely</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?path=/foo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Upload the web application archive (WAR) file that is specified as the
request data in this HTTP PUT request, install it into the <code>appBase</code>
directory of our corresponding virtual host, and start it on the context path
specified by the <code>path</code> request parameter. If no <code>path</code>
is specified the directory name or the war file name without the .war extension
is used as the path. The application can
later be undeployed (and the corresponding application directory removed)
by use of the <code>/undeploy</code>.</p>
<p>The .WAR file may include Tomcat specific deployment configuration, by
including a Context configuration XML file in
<code>/META-INF/context.xml</code>.</p>
<p>URL parameters include:
<ul>
<li><code>update</code>: When set to true, any existing update will be
undeployed first. The default value is set to false.</li>
<li><code>tag</code>: Specifying a tag name, this allows associating the
deployed webapp with a version number. The application version can
be later redeployed when needed using only the tag.</li>
</ul>
</p>
<p><strong>NOTE</strong> - This command is the logical
opposite of the <code>/undeploy</code> command.</p>
<p>If installation and startup is successful, you will receive a response
like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Deployed application at context path /foo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Application already exists at path /foo</em>
<blockquote>
<p>The context paths for all currently running web applications must be
unique. Therefore, you must either remove or undeploy the existing web
application using this context path, or choose a different context path
for the new one. The <code>update</code> parameter may be specified as
a parameter on the URL, with a value of <code>true</code> to avoid this
error. In that case, an undeploy will be performed on an existing
application before performing the deployment.</p>
</blockquote></li>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the new web application.
Check the Tomcat 5 logs for the details, but likely explanations include
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
classes encountered when initializing application event listeners and
filters.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a zero-length string.</p>
</blockquote></li>
<li><em>No context path was specified</em>
<blockquote>
The <code>path</code> parameter is required.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><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>
<p>Install and start a new web application, attached to the specified context
<code>path</code> (which must not be in use by any other web application).
This command is the logical opposite of the <code>/remove</code> command.</p>
<p>There are a number of different ways the install command can be used.</p>
<h3>Install a version of a previously deployed webapp</h3>
<p>This can be used to deploy a previous version of a web applicaion, which
has been deployed using the <code>tag</code> attribute. Note that the work
directory for the manager webapp will contain the previously deployed WARs;
removing it would make the deployment fail.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?path=/footoo&amp;tag=footag
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<h3>Install a Directory or WAR by URL</h3>
<p>Install a web application directory or ".war" file located on the Tomcat
server. If no <code>path</code> is specified, the directory name or the war file
name without the ".war" extension is used as the path. The <code>war</code>
parameter specifies a URL (including the <code>file:</code> scheme) for either
a directory or a web application archive (WAR) file. The supported syntax for
a URL referring to a WAR file is described on the Javadocs page for the
<code>java.net.JarURLConnection</code> class. Use only URLs that refer to
the entire WAR file.</p>
<p>In this example the web application located in the directory
<code>/path/to/foo</code> on the Tomcat server is installed as the
web application context named <code>/footoo</code>.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?path=/footoo&amp;war=file:/path/to/foo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<p>In this example the ".war" file <code>/path/to/bar.war</code> on the
Tomcat server is installed as the web application context named
<code>/bar</code>. Notice that there is no <code>path</code> parameter
so the context path defaults to the name of the web application archive
file without the ".war" extension.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?war=jar:file:/path/to/bar.war!/
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<h3>Install a Directory or War from the Host appBase</h3>
<p>Install a web application directory or ".war" file located in your Host
appBase directory. If no <code>path</code> is specified the directory name
or the war file name without the ".war" extension is used as the path.</p>
<p>In this example the web application located in a sub directory named
<code>foo</code> in the Host appBase directory of the Tomcat server is
installed as the web application context named <code>/foo</code>. Notice
that there is no <code>path</code> parameter so the context path defaults
to the name of the web application directory.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?war=foo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<p>In this example the ".war" file <code>bar.war</code> located in your
Host appBase directory on the Tomcat server is installed as the web
application context named <code>/bartoo</code>.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?path=/bartoo&amp;war=bar.war
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<h3>Install using a Context configuration ".xml" file</h3>
<p>If the Host deployXML flag is set to true you can install a web
application using a Context configuration ".xml" file and an optional
".war" file or web application directory. The context <code>path</code>
is not used when installing a web application using a context ".xml"
configuration file.</p>
<p>A Context configuration ".xml" file can contain valid XML for a
web application Context just as if it were configured in your
Tomcat <code>server.xml</code> configuration file. Here is an
example:
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
&lt;Context path="/foobar" docBase="/path/to/application/foobar"
debug="0"&gt;
&lt;!-- Link to the user database we will get roles from --&gt;
&lt;ResourceLink name="users" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/&gt;
&lt;/Context&gt;
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<p>When the optional <code>war</code> parameter is set to the URL
for a web application ".war" file or directory it overrides any
docBase configured in the context configuration ".xml" file.</p>
<p>Here is an example of installing an application using a Context
configuration ".xml" file.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?config=file:/path/context.xml
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<p>Here is an example of installing an application using a Context
configuration ".xml" file and a web application ".war" file located
on the server.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/deploy?config=file:/path/context.xml&amp;war=jar:file:/path/bar.war!/
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</p>
<h3>Installation Notes</h3>
<p>If the Host is configured with unpackWARs=true and you install a war
file, the war will be unpacked into a directory in your Host appBase
directory.</p>
<p>If the application war or directory is installed in your Host appBase
directory and either the Host is configured with autoDeploy=true or
liveDeploy=true, the Context path must match the directory name or
war file name without the ".war" extension.</p>
<p>For security when untrusted users can manage web applications, the
Host deployXML flag can be set to false. This prevents untrusted users
from installing web applications using a configuration XML file and
also prevents them from installing application directories or ".war"
files located outside of their Host appBase.</p>
<h3>Install Response</h3>
<p>If installation and startup is successful, you will receive a response
like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Deployed application at context path /foo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Application already exists at path /foo</em>
<blockquote>
<p>The context paths for all currently running web applications must be
unique. Therefore, you must either remove or undeploy the existing web
application using this context path, or choose a different context path
for the new one. The <code>update</code> parameter may be specified as
a parameter on the URL, with a value of <code>true</code> to avoid this
error. In that case, an undeploy will be performed on an existing
application before performing the deployment.</p>
</blockquote></li>
<li><em>Document base does not exist or is not a readable directory</em>
<blockquote>
<p>The URL specified by the <code>war</code> parameter must identify a
directory on this server that contains the "unpacked" version of a
web application, or the absolute URL of a web application archive (WAR)
file that contains this application. Correct the value specified by
the <code>war</code> parameter.</p>
</blockquote></li>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the new web application.
Check the Tomcat 5 logs for the details, but likely explanations include
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
classes encountered when initializing application event listeners and
filters.</p>
</blockquote></li>
<li><em>Invalid application URL was specified</em>
<blockquote>
<p>The URL for the directory or web application that you specified
was not valid. Such URLs must start with <code>file:</code>, and URLs
for a WAR file must end in ".war".</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a "/" string.</p>
</blockquote></li>
<li><em>Context path must match the directory or WAR file name:</em>
<blockquote>
If the application war or directory is installed in your Host appBase
directory and either the Host is configured with autoDeploy=true or
liveDeploy=true, the Context path must match the directory name or
war file name without the ".war" extension.
</blockquote></li>
<li><em>Only web applications in the Host web application directory can
be installed</em>
<blockquote>
If the Host deployXML flag is set to false this error will happen
if an attempt is made to install a web application directory or
".war" file outside of the Host appBase directory.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="List Currently Deployed and Installed Applications"><strong>List Currently Deployed and Installed Applications</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/list
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>List the context paths, current status (<code>running</code> or
<code>stopped</code>), and number of active sessions for all currently
deployed and installed web applications. A typical response immediately
after starting Tomcat might look like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Listed applications for virtual host localhost
/webdav:running:0
/examples:running:0
/manager:running:0
/:running:0
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Reload An Existing Application"><strong>Reload An Existing Application</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/reload?path=/examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Signal an existing application to shut itself down and reload. This can
be useful when the web application context is not reloadable and you have
updated classes or property files in the <code>/WEB-INF/classes</code>
directory or when you have added or updated jar files in the
<code>/WEB-INF/lib</code> directory.
</p>
<p><strong>NOTE:</strong> The <code>/WEB-INF/web.xml</code>
web application configuration file is not reread on a reload.
If you have made changes to your web.xml file you must stop
then start the web application.
</p>
<p>If this command succeeds, you will see a response like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Reloaded application at context path /examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to restart the web application.
Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a zero-length string.</p>
</blockquote></li>
<li><em>No context exists for path /foo</em>
<blockquote>
<p>There is no deployed or installed application on the context path
that you specified.</p>
</blockquote></li>
<li><em>No context path was specified</em>
<blockquote>
The <code>path</code> parameter is required.
</blockquote></li>
<li><em>Reload not supported on WAR deployed at path /foo</em>
<blockquote>
Currently, application reloading (to pick up changes to the classes or
<code>web.xml</code> file) is not supported when a web application is
installed directly from a WAR file. It only works when the web application
is installed from an unpacked directory. If you are using a WAR file,
you should <code>remove</code> and then <code>install</code> the
application again to pick up your changes.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="List OS and JVM Properties"><strong>List OS and JVM Properties</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/serverinfo
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Lists information about the Tomcat version, OS, and JVM properties.</p>
<p>If an error occurs, the response will start with <code>FAIL</code> and
include an error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to enumerate the system properties.
Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="List Available Global JNDI Resources"><strong>List Available Global JNDI Resources</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/resources[?type=xxxxx]
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>List the global JNDI resources that are available for use in resource
links for context configuration files. If you specify the <code>type</code>
request parameter, the value must be the fully qualified Java class name of
the resource type you are interested in (for example, you would specify
<code>javax.sql.DataSource</code> to acquire the names of all available
JDBC data sources). If you do not specify the <code>type</code> request
parameter, resources of all types will be returned.</p>
<p>Depending on whether the <code>type</code> request parameter is specfied
or not, the first line of a normal response will be:</p>
<pre>
OK - Listed global resources of all types
</pre>
<p>or</p>
<pre>
OK - Listed global resources of type xxxxx
</pre>
<p>followed by one line for each resource. Each line is composed of fields
delimited by colon characters (":"), as follows:</p>
<ul>
<li><em>Global Resource Name</em> - The name of this global JNDI resource,
which would be used in the <code>global</code> attribute of a
<code>&lt;ResourceLink&gt;</code> element.</li>
<li><em>Global Resource Type</em> - The fully qualified Java class name of
this global JNDI resource.</li>
</ul>
<p>If an error occurs, the response will start with <code>FAIL</code> and
include an error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to enumerate the global JNDI
resources. Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
<li><em>No global JNDI resources are available</em>
<blockquote>
<p>The Tomcat server you are running has been configured without
global JNDI resources.</p>
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="List Available Security Roles"><strong>List Available Security Roles</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/roles
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>List the security role names (and corresponding descriptions) that are
available in the <code>org.apache.catalina.UserDatabase</code> resource that
is linked to the <code>users</code> resource reference in the web.xml file
for the Manager web application. This would typically be used, for example,
by a deployment tool that wanted to create
<code>&lt;security-role-ref&gt;</code> elements to map security role names
used in a web application to the role names actually defined within the
container.</p>
<p>By default, the <code>users</code> resource reference is pointed at the
global <code>UserDatabase</code> resource. If you choose to utilize a
different user database per virtual host, you should modify the
<code>&lt;ResourceLink&gt;</code> element in the default
<code>manager.xml</code> context configuration file to point at the global
user database resource for this virtual host.</p>
<p>When this command is executed, the first line of the response will be:</p>
<pre>
OK - Listed security roles
</pre>
<p>followed by one line for each security role. Each line is composed of
fields delimited by colon characters (":") as follows:</p>
<ul>
<li><em>Security Role Name</em> - A security role name that is known to Tomcat
in the user database.</li>
<li><em>Description</em> - Description of this security role (useful in
creating user interfaces for selecting roles.</li>
</ul>
<p>If an error occurs, the response will start with <code>FAIL</code> and
include an error message. Possible causes for problems include:</p>
<ul>
<li><em>Cannot resolve user database reference</em> - A JNDI error prevented
the successful lookup of the <code>org.apache.catalina.UserDatabase</code>
resource. Check the Tomcat log files for a stack trace associated with
this error.</li>
<li><em>No user database is available</em> - You have not configured a resource
reference for the <code>users</code> resource that points at an
appropriate user database instance. Check your <code>manager.xml</code>
file and ensure that you have created an appropriate
<code>&lt;ResourceLink&gt;</code> or
<code>&lt;ResourceParams&gt;</code> element for this resource.</li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Session Statistics"><strong>Session Statistics</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/sessions?path=/examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Display the default session timeout for a web application, and the
number of currently active sessions that fall within ten-minute ranges of
their actual timeout times. For example, after restarting Tomcat and then
executing one of the JSP samples in the <code>/examples</code> web app,
you might get something like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Session information for application at context path /examples
Default maximum session inactive interval 30 minutes
30 - &lt;40 minutes:1 sessions
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Start an Existing Application"><strong>Start an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/start?path=/examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Signal a stopped application to restart, and make itself available again.
Stopping and starting is useful, for example, if the database required by
your application becomes temporarily unavailable. It is usually better to
stop the web application that relies on this database rather than letting
users continuously encounter database exceptions.</p>
<p>If this command succeeds, you will see a response like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Started application at context path /examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the web application.
Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a zero-length string.</p>
</blockquote></li>
<li><em>No context exists for path /foo</em>
<blockquote>
<p>There is no deployed or installed application on the context path
that you specified.</p>
</blockquote></li>
<li><em>No context path was specified</em>
<blockquote>
The <code>path</code> parameter is required.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Stop an Existing Application"><strong>Stop an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/stop?path=/examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Signal an existing application to make itself unavailable, but leave it
deployed or installed. Any request that comes in while an application is
stopped will see an HTTP error 404, and this application will show as
"stopped" on a list applications command.</p>
<p>If this command succeeds, you will see a response like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Stopped application at context path /examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to stop the web application.
Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a zero-length string.</p>
</blockquote></li>
<li><em>No context exists for path /foo</em>
<blockquote>
<p>There is no deployed or installed application on the context path
that you specified.</p>
</blockquote></li>
<li><em>No context path was specified</em>
<blockquote>
The <code>path</code> parameter is required.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Undeploy an Existing Application"><strong>Undeploy an Existing Application</strong></a></font></td></tr><tr><td><blockquote>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/undeploy?path=/examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p><strong><font color="red">WARNING</font> - This command will
delete the contents of the web application directory if it exists within the
<code>appBase</code> directory (typically "webapps") for this virtual host
</strong>. This will also delete the source .WAR if expanding occurred, as
well as the XML Context definition. If you simply want to take an application
out of service, you should use the <code>/stop</code> command instead.</p>
<p>Signal an existing application to gracefully shut itself down, and
remove it from Tomcat (which also makes this context path available for
reuse later). In addition, the document root directory is removed, if it
exists in the <code>appBase</code> directory (typically "webapps") for
this virtual host. This command is the logical opposite of the
<code>/deploy</code> command.</p>
<p>If this command succeeds, you will see a response like this:</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
OK - Undeployed application at context path /examples
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
<p>Otherwise, the response will start with <code>FAIL</code> and include an
error message. Possible causes for problems include:</p>
<ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to undeploy the web application.
Check the Tomcat 5 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<p>The context path must start with a slash character, unless you are
referencing the ROOT web application -- in which case the context path
must be a zero-length string.</p>
</blockquote></li>
<li><em>No context exists for path /foo</em>
<blockquote>
<p>There is no deployed or installed application on the context path
that you specified.</p>
</blockquote></li>
<li><em>No context path was specified</em>
<blockquote>
The <code>path</code> parameter is required.
</blockquote></li>
</ul>
</blockquote></td></tr></table>
</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Executing Manager Commands With Ant"><strong>Executing Manager Commands With Ant</strong></a></font></td></tr><tr><td><blockquote>
<p>In addition to the ability to execute Manager commands via HTTP requests,
as documented above, Tomcat 5 includes a convenient set of Task definitions
for the <em>Ant</em> (version 1.4 or later) build tool. In order to use these
commands, you must perform the following setup operations:</p>
<ul>
<li>Download the binary distribution of Ant from
http://jakarta.apache.org/ant.
You must use version <strong>1.4</strong> or later.</li>
<li>Install the Ant distribution in a convenient directory (called
ANT_HOME in the remainder of these instructions).</li>
<li>Copy the file <code>server/lib/catalina-ant.jar</code> from your Tomcat 5
installation into Ant's library directory (<code>$ANT_HOME/lib</code>).
</li>
<li>Add the <code>$ANT_HOME/bin</code> directory to your <code>PATH</code>
environment variable.</li>
<li>Configure at least one username/password combination in your Tomcat
user database that includes the <code>manager</code> role.</li>
</ul>
<p>To use custom tasks within Ant, you must declare them first with a
<code>&lt;taskdef&gt;</code> element. Therefore, your <code>build.xml</code>
file might look something like this:</p>
<table border="1">
<tr><td><pre>
&lt;project name="My Application" default="compile" basedir="."&gt;
&lt;!-- Configure the directory into which the web application is built --&gt;
&lt;property name="build" value="${basedir}/build"/&gt;
&lt;!-- Configure the context path for this application --&gt;
&lt;property name="path" value="/myapp"/&gt;
&lt;!-- Configure properties to access the Manager application --&gt;
&lt;property name="url" value="http://localhost:8080/manager"/&gt;
&lt;property name="username" value="myusername"/&gt;
&lt;property name="password" value="mypassword"/&gt;
&lt;!-- Configure the custom Ant tasks for the Manager application --&gt;
&lt;taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/&gt;
&lt;taskdef name="list" classname="org.apache.catalina.ant.ListTask"/&gt;
&lt;taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/&gt;
&lt;taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/&gt;
&lt;taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/&gt;
&lt;taskdef name="start" classname="org.apache.catalina.ant.StartTask"/&gt;
&lt;taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/&gt;
&lt;taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/&gt;
&lt;!-- Executable Targets --&gt;
&lt;target name="compile" description="Compile web application"&gt;
&lt;!-- ... construct web application in ${build} subdirectory, and
generated a ${path}.war ... --&gt;
&lt;/target&gt;
&lt;target name="deploy" description="Install web application"
depends="compile"&gt;
&lt;deploy url="${url}" username="${username}" password="${password}"
path="${path}" war="${build}${path}.war"/&gt;
&lt;/target&gt;
&lt;target name="reload" description="Reload web application"
depends="compile"&gt;
&lt;reload url="${url}" username="${username}" password="${password}"
path="${path}"/&gt;
&lt;/target&gt;
&lt;target name="undeploy" description="Remove web application"&gt;
&lt;undeploy url="${url}" username="${username}" password="${password}"
path="${path}"/&gt;
&lt;/target&gt;
&lt;/project&gt;
</pre></td></tr>
</table>
<p>Now, you can execute commands like <code>ant deploy</code> to deploy the
applcation to a running instance of Tomcat, or <code>ant reload</code> to
tell Tomcat to reload it. Note also that most of the interesting values in
this <code>build.xml</code> file are defined as replaceable properties, so
you can override their values from the command line. For example, you might
consider it a security risk to include the real manager password in your
<code>build.xml</code> file's source code. To avoid this, omit the password
property, and specify it from the command line:</p>
<pre>
ant -Dpassword=secret deploy
</pre>
</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Using the JMX Proxy Servlet"><strong>Using the JMX Proxy Servlet</strong></a></font></td></tr><tr><td><blockquote>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="What is JMX Proxy Servlet"><strong>What is JMX Proxy Servlet</strong></a></font></td></tr><tr><td><blockquote>
The JMX Proxy Servlet is a lightweight proxy to get and set the
tomcat internals. (Or any class that has been exposed via an MBean)
Its usage is not very user friendly but the UI is
extremely help for integrating command line scripts for monitoring
and changing the internals of tomcat. You can do two things with the proxy:
get information and set information. For you to really understand the
JMX Proxy Servlet, you should have a general understanding of JMX.
If you don't know what JMX is, then prepare to be confused.
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMX Query command"><strong>JMX Query command</strong></a></font></td></tr><tr><td><blockquote>
This takes the form:
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://webserver/manager/jmxproxy/?qry=STUFF
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
Where <code>STUFF</code> is the JMX query you wish to perform. For example,
here are some queries you might wish to run:
<ul>
<li>
<code>qry=*%3Atype%3DRequestProcessor%2C* --&gt;
type=RequestProcessor</code> which will locate all
workers which can process requests and report
their state.
</li>
<li>
<code>qry=*%3Aj2eeType=Servlet%2c* --&gt;
j2eeType=Servlet</code> which return all loaded servlets.
</li>
<li>
<code>qry=Catalina%3Atype%3DEnvironment%2Cresourcetype%3DGlobal%2Cname%3DsimpleValue --&gt;
Catalina:type=Environment,resourcetype=Global,name=simpleValue</code>
which look for a specific MBean by the given name.
</li>
</ul>
You'll need to experiment with this to really understand its capabilites.
If you provide no <code>qry</code> parameter, then all of the MBeans will
be displayed. We really recommend looking at the tomcat source code and
understand the JMX spec to get a better understanding of all the queries
you may run.
</blockquote></td></tr></table>
<table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMX Set command"><strong>JMX Set command</strong></a></font></td></tr><tr><td><blockquote>
Now that you can query an MBean, its time to muck with Tomcat's internals!
The general form of the set command is :
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://webserver/manager/jmxproxy/?set=BEANNAME&amp;att=MYATTRIBUTE&amp;val=NEWVALUE
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
So you need to provide 3 request parameters:
<ol>
<li><code>set</code>: The full bean name</li>
<li><code>att</code>: The attribute you wish to alter</li>
<li><code>val</code>: The new value </li>
</ol>
If all goes ok, then it will say OK, otherwise an error message will be
shown. For example, lets say we wish to turn up debugging on the fly for the
<code>ErrorReportValve</code>. The following will set debugging to 10.
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/jmxproxy/
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost&amp;att=debug&amp;val=10
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
and my result is (YMMV):
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
Result: ok
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
Here is what I see if I pass in a bad value. Here is the URL I used,
I try set debugging equal to 'cowbell':
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
http://localhost:8080/manager/jmxproxy/
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost&amp;att=debug&amp;val=cowbell
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
When I try that, my result is
<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
Error: java.lang.NumberFormatException: For input string: "cowbell"
</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr></table></div>
</blockquote></td></tr></table>
</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade="noshade"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em>
Copyright &copy; 1999-2003, Apache Software Foundation
</em></font></div></td></tr></table></body></html>