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