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