Lines 70-82
Link Here
|
70 |
<code>manager.xml</code> context configuration file in the |
70 |
<code>manager.xml</code> context configuration file in the |
71 |
<code>$CATALINA_BASE/conf/[enginename]/[hostname]</code> folder. Here is an |
71 |
<code>$CATALINA_BASE/conf/[enginename]/[hostname]</code> folder. Here is an |
72 |
example:</p> |
72 |
example:</p> |
73 |
<pre> |
73 |
<source><![CDATA[<Context privileged="true" antiResourceLocking="false" |
74 |
<Context privileged="true" antiResourceLocking="false" |
74 |
docBase="${catalina.home}/webapps/manager"> |
75 |
docBase="${catalina.home}/webapps/manager"> |
75 |
<Valve className="org.apache.catalina.valves.RemoteAddrValve" |
76 |
<Valve className="org.apache.catalina.valves.RemoteAddrValve" |
76 |
allow="127\.0\.0\.1" /> |
77 |
allow="127\.0\.0\.1" /> |
77 |
</Context>]]></source> |
78 |
</Context> |
|
|
79 |
</pre> |
80 |
|
78 |
|
81 |
<p>If you have Tomcat configured to support multiple virtual hosts |
79 |
<p>If you have Tomcat configured to support multiple virtual hosts |
82 |
(websites) you would need to configure a Manager for each.</p> |
80 |
(websites) you would need to configure a Manager for each.</p> |
Lines 89-99
Link Here
|
89 |
<li>A minimal version using HTTP requests only which is suitable for use |
87 |
<li>A minimal version using HTTP requests only which is suitable for use |
90 |
by scripts setup by system administrators. Commands are given as part of the |
88 |
by scripts setup by system administrators. Commands are given as part of the |
91 |
request URI, and responses are in the form of simple text that can be easily |
89 |
request URI, and responses are in the form of simple text that can be easily |
92 |
parsed and processed. See <a href="#Supported Manager Commands"> |
90 |
parsed and processed. See <a href="#Supported_Manager_Commands"> |
93 |
Supported Manager Commands</a> for more information.</li> |
91 |
Supported Manager Commands</a> for more information.</li> |
94 |
<li>A convenient set of task definitions for the <em>Ant</em> |
92 |
<li>A convenient set of task definitions for the <em>Ant</em> |
95 |
(version 1.4 or later) build tool. See |
93 |
(version 1.4 or later) build tool. See |
96 |
<a href="#Executing Manager Commands With Ant">Executing Manager Commands |
94 |
<a href="#Executing_Manager_Commands_With_Ant">Executing Manager Commands |
97 |
With Ant</a> for more information.</li> |
95 |
With Ant</a> for more information.</li> |
98 |
</ul> |
96 |
</ul> |
99 |
|
97 |
|
Lines 101-113
Link Here
|
101 |
|
99 |
|
102 |
<section name="Configuring Manager Application Access"> |
100 |
<section name="Configuring Manager Application Access"> |
103 |
|
101 |
|
104 |
<blockquote> |
102 |
|
105 |
<p><em>The description below uses the variable name $CATALINA_BASE to refer the |
103 |
<p><em>The description below uses the variable name $CATALINA_BASE to refer the |
106 |
base directory against which most relative paths are resolved. If you have |
104 |
base directory against which most relative paths are resolved. If you have |
107 |
not configured Tomcat for multiple instances by setting a CATALINA_BASE |
105 |
not configured Tomcat for multiple instances by setting a CATALINA_BASE |
108 |
directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, |
106 |
directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, |
109 |
the directory into which you have installed Tomcat.</em></p> |
107 |
the directory into which you have installed Tomcat.</em></p> |
110 |
</blockquote> |
108 |
|
111 |
|
109 |
|
112 |
<p>It would be quite unsafe to ship Tomcat with default settings that allowed |
110 |
<p>It would be quite unsafe to ship Tomcat with default settings that allowed |
113 |
anyone on the Internet to execute the Manager application on your server. |
111 |
anyone on the Internet to execute the Manager application on your server. |
Lines 175-183
Link Here
|
175 |
edited with any text editor. This file contains an XML |
173 |
edited with any text editor. This file contains an XML |
176 |
<code><user></code> for each individual user, which might |
174 |
<code><user></code> for each individual user, which might |
177 |
look something like this: |
175 |
look something like this: |
178 |
<source> |
176 |
<source><![CDATA[<user name="craigmcc" password="secret" roles="standard,manager-script" />]]></source> |
179 |
<user name="craigmcc" password="secret" roles="standard,manager-script" /> |
|
|
180 |
</source> |
181 |
which defines the username and password used by this individual to |
177 |
which defines the username and password used by this individual to |
182 |
log on, and the role names he or she is associated with. You can |
178 |
log on, and the role names he or she is associated with. You can |
183 |
add the <strong>manager-script</strong> role to the comma-delimited |
179 |
add the <strong>manager-script</strong> role to the comma-delimited |
Lines 207-218
Link Here
|
207 |
See <a href="config/valve.html#Remote_Address_Filter">valves documentation</a> |
203 |
See <a href="config/valve.html#Remote_Address_Filter">valves documentation</a> |
208 |
for details. Here is |
204 |
for details. Here is |
209 |
an example of restricting access to the localhost by IP address:</p> |
205 |
an example of restricting access to the localhost by IP address:</p> |
210 |
<pre> |
206 |
<source><![CDATA[<Context privileged="true"> |
211 |
<Context privileged="true"> |
207 |
<Valve className="org.apache.catalina.valves.RemoteAddrValve" |
212 |
<Valve className="org.apache.catalina.valves.RemoteAddrValve" |
208 |
allow="127\.0\.0\.1"/> |
213 |
allow="127\.0\.0\.1"/> |
209 |
</Context>]]></source> |
214 |
</Context> |
|
|
215 |
</pre> |
216 |
|
210 |
|
217 |
</section> |
211 |
</section> |
218 |
|
212 |
|
Lines 221-229
Link Here
|
221 |
|
215 |
|
222 |
<p>All commands that the Manager application knows how to process are |
216 |
<p>All commands that the Manager application knows how to process are |
223 |
specified in a single request URI like this:</p> |
217 |
specified in a single request URI like this:</p> |
224 |
<source> |
218 |
<source>http://{host}:{port}/manager/text/{command}?{parameters}</source> |
225 |
http://{host}:{port}/manager/text/{command}?{parameters} |
|
|
226 |
</source> |
227 |
<p>where <code>{host}</code> and <code>{port}</code> represent the hostname |
219 |
<p>where <code>{host}</code> and <code>{port}</code> represent the hostname |
228 |
and port number on which Tomcat is running, <code>{command}</code> |
220 |
and port number on which Tomcat is running, <code>{command}</code> |
229 |
represents the Manager command you wish to execute, and |
221 |
represents the Manager command you wish to execute, and |
Lines 282-290
Link Here
|
282 |
|
274 |
|
283 |
<subsection name="Deploy A New Application Remotely"> |
275 |
<subsection name="Deploy A New Application Remotely"> |
284 |
|
276 |
|
285 |
<source> |
277 |
<source>http://localhost:8080/manager/text/deploy?path=/foo</source> |
286 |
http://localhost:8080/manager/text/deploy?path=/foo |
|
|
287 |
</source> |
288 |
|
278 |
|
289 |
<p>Upload the web application archive (WAR) file that is specified as the |
279 |
<p>Upload the web application archive (WAR) file that is specified as the |
290 |
request data in this HTTP PUT request, install it into the <code>appBase</code> |
280 |
request data in this HTTP PUT request, install it into the <code>appBase</code> |
Lines 311-325
Link Here
|
311 |
|
301 |
|
312 |
<p>If installation and startup is successful, you will receive a response |
302 |
<p>If installation and startup is successful, you will receive a response |
313 |
like this:</p> |
303 |
like this:</p> |
314 |
<source> |
304 |
<source>OK - Deployed application at context path /foo</source> |
315 |
OK - Deployed application at context path /foo |
|
|
316 |
</source> |
317 |
|
305 |
|
318 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
306 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
319 |
error message. Possible causes for problems include:</p> |
307 |
error message. Possible causes for problems include:</p> |
320 |
<ul> |
308 |
<ul> |
321 |
<li><em>Application already exists at path /foo</em> |
309 |
<li><em>Application already exists at path /foo</em> |
322 |
<blockquote> |
|
|
323 |
<p>The context paths for all currently running web applications must be |
310 |
<p>The context paths for all currently running web applications must be |
324 |
unique. Therefore, you must undeploy the existing web |
311 |
unique. Therefore, you must undeploy the existing web |
325 |
application using this context path, or choose a different context path |
312 |
application using this context path, or choose a different context path |
Lines 327-341
Link Here
|
327 |
a parameter on the URL, with a value of <code>true</code> to avoid this |
314 |
a parameter on the URL, with a value of <code>true</code> to avoid this |
328 |
error. In that case, an undeploy will be performed on an existing |
315 |
error. In that case, an undeploy will be performed on an existing |
329 |
application before performing the deployment.</p> |
316 |
application before performing the deployment.</p> |
330 |
</blockquote></li> |
317 |
</li> |
331 |
<li><em>Encountered exception</em> |
318 |
<li><em>Encountered exception</em> |
332 |
<blockquote> |
|
|
333 |
<p>An exception was encountered trying to start the new web application. |
319 |
<p>An exception was encountered trying to start the new web application. |
334 |
Check the Tomcat logs for the details, but likely explanations include |
320 |
Check the Tomcat logs for the details, but likely explanations include |
335 |
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing |
321 |
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing |
336 |
classes encountered when initializing application event listeners and |
322 |
classes encountered when initializing application event listeners and |
337 |
filters.</p> |
323 |
filters.</p> |
338 |
</blockquote></li> |
324 |
</li> |
339 |
</ul> |
325 |
</ul> |
340 |
|
326 |
|
341 |
</subsection> |
327 |
</subsection> |
Lines 348-365
Link Here
|
348 |
|
334 |
|
349 |
<p>There are a number of different ways the deploy command can be used.</p> |
335 |
<p>There are a number of different ways the deploy command can be used.</p> |
350 |
|
336 |
|
351 |
<h3>Deploy a previously deployed webapp</h3> |
337 |
<h5>Deploy a previously deployed webapp</h5> |
352 |
|
338 |
|
353 |
<p>This can be used to deploy a previously deployed web application, which |
339 |
<p>This can be used to deploy a previously deployed web application, which |
354 |
has been deployed using the <code>tag</code> attribute. Note that the work |
340 |
has been deployed using the <code>tag</code> attribute. Note that the work |
355 |
directory for the Manager webapp will contain the previously deployed WARs; |
341 |
directory for the Manager webapp will contain the previously deployed WARs; |
356 |
removing it would make the deployment fail.</p> |
342 |
removing it would make the deployment fail.</p> |
357 |
<source> |
343 |
<source>http://localhost:8080/manager/text/deploy?path=/footoo&tag=footag</source> |
358 |
http://localhost:8080/manager/text/deploy?path=/footoo&tag=footag |
|
|
359 |
</source> |
360 |
|
344 |
|
361 |
|
345 |
|
362 |
<h3>Deploy a Directory or WAR by URL</h3> |
346 |
<h5>Deploy a Directory or WAR by URL</h5> |
363 |
|
347 |
|
364 |
<p>Deploy a web application directory or ".war" file located on the Tomcat |
348 |
<p>Deploy a web application directory or ".war" file located on the Tomcat |
365 |
server. If no <code>path</code> is specified, the directory name or the war file |
349 |
server. If no <code>path</code> is specified, the directory name or the war file |
Lines 373-381
Link Here
|
373 |
<p>In this example the web application located in the directory |
357 |
<p>In this example the web application located in the directory |
374 |
<code>/path/to/foo</code> on the Tomcat server is deployed as the |
358 |
<code>/path/to/foo</code> on the Tomcat server is deployed as the |
375 |
web application context named <code>/footoo</code>.</p> |
359 |
web application context named <code>/footoo</code>.</p> |
376 |
<source> |
360 |
<source>http://localhost:8080/manager/text/deploy?path=/footoo&war=file:/path/to/foo</source> |
377 |
http://localhost:8080/manager/text/deploy?path=/footoo&war=file:/path/to/foo |
|
|
378 |
</source> |
379 |
|
361 |
|
380 |
|
362 |
|
381 |
<p>In this example the ".war" file <code>/path/to/bar.war</code> on the |
363 |
<p>In this example the ".war" file <code>/path/to/bar.war</code> on the |
Lines 383-394
Link Here
|
383 |
<code>/bar</code>. Notice that there is no <code>path</code> parameter |
365 |
<code>/bar</code>. Notice that there is no <code>path</code> parameter |
384 |
so the context path defaults to the name of the web application archive |
366 |
so the context path defaults to the name of the web application archive |
385 |
file without the ".war" extension.</p> |
367 |
file without the ".war" extension.</p> |
386 |
<source> |
368 |
<source>http://localhost:8080/manager/text/deploy?war=jar:file:/path/to/bar.war!/</source> |
387 |
http://localhost:8080/manager/text/deploy?war=jar:file:/path/to/bar.war!/ |
|
|
388 |
</source> |
389 |
|
369 |
|
390 |
|
370 |
|
391 |
<h3>Deploy a Directory or War from the Host appBase</h3> |
371 |
<h5>Deploy a Directory or War from the Host appBase</h5> |
392 |
|
372 |
|
393 |
<p>Deploy a web application directory or ".war" file located in your Host |
373 |
<p>Deploy a web application directory or ".war" file located in your Host |
394 |
appBase directory. The directory name or the war file name without the ".war" |
374 |
appBase directory. The directory name or the war file name without the ".war" |
Lines 398-417
Link Here
|
398 |
<code>foo</code> in the Host appBase directory of the Tomcat server is |
378 |
<code>foo</code> in the Host appBase directory of the Tomcat server is |
399 |
deployed as the web application context named <code>/foo</code>. Notice |
379 |
deployed as the web application context named <code>/foo</code>. Notice |
400 |
that the context path used is the name of the web application directory.</p> |
380 |
that the context path used is the name of the web application directory.</p> |
401 |
<source> |
381 |
<source>http://localhost:8080/manager/text/deploy?war=foo</source> |
402 |
http://localhost:8080/manager/text/deploy?war=foo |
|
|
403 |
</source> |
404 |
|
382 |
|
405 |
|
383 |
|
406 |
<p>In this example the ".war" file <code>bar.war</code> located in your |
384 |
<p>In this example the ".war" file <code>bar.war</code> located in your |
407 |
Host appBase directory on the Tomcat server is deployed as the web |
385 |
Host appBase directory on the Tomcat server is deployed as the web |
408 |
application context named <code>/bar</code>.</p> |
386 |
application context named <code>/bar</code>.</p> |
409 |
<source> |
387 |
<source>http://localhost:8080/manager/text/deploy?war=bar.war</source> |
410 |
http://localhost:8080/manager/text/deploy?war=bar.war |
|
|
411 |
</source> |
412 |
|
388 |
|
413 |
|
389 |
|
414 |
<h3>Deploy using a Context configuration ".xml" file</h3> |
390 |
<h5>Deploy using a Context configuration ".xml" file</h5> |
415 |
|
391 |
|
416 |
<p>If the Host deployXML flag is set to true you can deploy a web |
392 |
<p>If the Host deployXML flag is set to true you can deploy a web |
417 |
application using a Context configuration ".xml" file and an optional |
393 |
application using a Context configuration ".xml" file and an optional |
Lines 423-432
Link Here
|
423 |
web application Context just as if it were configured in your |
399 |
web application Context just as if it were configured in your |
424 |
Tomcat <code>server.xml</code> configuration file. Here is an |
400 |
Tomcat <code>server.xml</code> configuration file. Here is an |
425 |
example:</p> |
401 |
example:</p> |
426 |
<source> |
402 |
<source><![CDATA[<Context path="/foobar" docBase="/path/to/application/foobar"> |
427 |
<Context path="/foobar" docBase="/path/to/application/foobar"> |
403 |
</Context>]]></source> |
428 |
</Context> |
|
|
429 |
</source> |
430 |
|
404 |
|
431 |
|
405 |
|
432 |
<p>When the optional <code>war</code> parameter is set to the URL |
406 |
<p>When the optional <code>war</code> parameter is set to the URL |
Lines 435-455
Link Here
|
435 |
|
409 |
|
436 |
<p>Here is an example of deploying an application using a Context |
410 |
<p>Here is an example of deploying an application using a Context |
437 |
configuration ".xml" file.</p> |
411 |
configuration ".xml" file.</p> |
438 |
<source> |
412 |
<source>http://localhost:8080/manager/text/deploy?config=file:/path/context.xml</source> |
439 |
http://localhost:8080/manager/text/deploy?config=file:/path/context.xml |
|
|
440 |
</source> |
441 |
|
413 |
|
442 |
|
414 |
|
443 |
<p>Here is an example of deploying an application using a Context |
415 |
<p>Here is an example of deploying an application using a Context |
444 |
configuration ".xml" file and a web application ".war" file located |
416 |
configuration ".xml" file and a web application ".war" file located |
445 |
on the server.</p> |
417 |
on the server.</p> |
446 |
<source> |
418 |
<source>http://localhost:8080/manager/text/deploy |
447 |
http://localhost:8080/manager/text/deploy |
419 |
?config=file:/path/context.xml&war=jar:file:/path/bar.war!/</source> |
448 |
?config=file:/path/context.xml&war=jar:file:/path/bar.war!/ |
|
|
449 |
</source> |
450 |
|
420 |
|
451 |
|
421 |
|
452 |
<h3>Deployment Notes</h3> |
422 |
<h5>Deployment Notes</h5> |
453 |
|
423 |
|
454 |
<p>If the Host is configured with unpackWARs=true and you deploy a war |
424 |
<p>If the Host is configured with unpackWARs=true and you deploy a war |
455 |
file, the war will be unpacked into a directory in your Host appBase |
425 |
file, the war will be unpacked into a directory in your Host appBase |
Lines 467-485
Link Here
|
467 |
files located outside of their Host appBase.</p> |
437 |
files located outside of their Host appBase.</p> |
468 |
|
438 |
|
469 |
|
439 |
|
470 |
<h3>Deploy Response</h3> |
440 |
<h5>Deploy Response</h5> |
471 |
|
441 |
|
472 |
<p>If installation and startup is successful, you will receive a response |
442 |
<p>If installation and startup is successful, you will receive a response |
473 |
like this:</p> |
443 |
like this:</p> |
474 |
<source> |
444 |
<source>OK - Deployed application at context path /foo</source> |
475 |
OK - Deployed application at context path /foo |
|
|
476 |
</source> |
477 |
|
445 |
|
478 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
446 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
479 |
error message. Possible causes for problems include:</p> |
447 |
error message. Possible causes for problems include:</p> |
480 |
<ul> |
448 |
<ul> |
481 |
<li><em>Application already exists at path /foo</em> |
449 |
<li><em>Application already exists at path /foo</em> |
482 |
<blockquote> |
|
|
483 |
<p>The context paths for all currently running web applications must be |
450 |
<p>The context paths for all currently running web applications must be |
484 |
unique. Therefore, you must undeploy the existing web |
451 |
unique. Therefore, you must undeploy the existing web |
485 |
application using this context path, or choose a different context path |
452 |
application using this context path, or choose a different context path |
Lines 487-534
Link Here
|
487 |
a parameter on the URL, with a value of <code>true</code> to avoid this |
454 |
a parameter on the URL, with a value of <code>true</code> to avoid this |
488 |
error. In that case, an undeploy will be performed on an existing |
455 |
error. In that case, an undeploy will be performed on an existing |
489 |
application before performing the deployment.</p> |
456 |
application before performing the deployment.</p> |
490 |
</blockquote></li> |
457 |
</li> |
491 |
<li><em>Document base does not exist or is not a readable directory</em> |
458 |
<li><em>Document base does not exist or is not a readable directory</em> |
492 |
<blockquote> |
|
|
493 |
<p>The URL specified by the <code>war</code> parameter must identify a |
459 |
<p>The URL specified by the <code>war</code> parameter must identify a |
494 |
directory on this server that contains the "unpacked" version of a |
460 |
directory on this server that contains the "unpacked" version of a |
495 |
web application, or the absolute URL of a web application archive (WAR) |
461 |
web application, or the absolute URL of a web application archive (WAR) |
496 |
file that contains this application. Correct the value specified by |
462 |
file that contains this application. Correct the value specified by |
497 |
the <code>war</code> parameter.</p> |
463 |
the <code>war</code> parameter.</p> |
498 |
</blockquote></li> |
464 |
</li> |
499 |
<li><em>Encountered exception</em> |
465 |
<li><em>Encountered exception</em> |
500 |
<blockquote> |
|
|
501 |
<p>An exception was encountered trying to start the new web application. |
466 |
<p>An exception was encountered trying to start the new web application. |
502 |
Check the Tomcat logs for the details, but likely explanations include |
467 |
Check the Tomcat logs for the details, but likely explanations include |
503 |
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing |
468 |
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing |
504 |
classes encountered when initializing application event listeners and |
469 |
classes encountered when initializing application event listeners and |
505 |
filters.</p> |
470 |
filters.</p> |
506 |
</blockquote></li> |
471 |
</li> |
507 |
<li><em>Invalid application URL was specified</em> |
472 |
<li><em>Invalid application URL was specified</em> |
508 |
<blockquote> |
|
|
509 |
<p>The URL for the directory or web application that you specified |
473 |
<p>The URL for the directory or web application that you specified |
510 |
was not valid. Such URLs must start with <code>file:</code>, and URLs |
474 |
was not valid. Such URLs must start with <code>file:</code>, and URLs |
511 |
for a WAR file must end in ".war".</p> |
475 |
for a WAR file must end in ".war".</p> |
512 |
</blockquote></li> |
476 |
</li> |
513 |
<li><em>Invalid context path was specified</em> |
477 |
<li><em>Invalid context path was specified</em> |
514 |
<blockquote> |
|
|
515 |
<p>The context path must start with a slash character. To reference the |
478 |
<p>The context path must start with a slash character. To reference the |
516 |
ROOT web application use "/".</p> |
479 |
ROOT web application use "/".</p> |
517 |
</blockquote></li> |
480 |
</li> |
518 |
<li><em>Context path must match the directory or WAR file name:</em> |
481 |
<li><em>Context path must match the directory or WAR file name:</em> |
519 |
<blockquote> |
482 |
<p>If the application war or directory is installed in your Host appBase |
520 |
If the application war or directory is installed in your Host appBase |
|
|
521 |
directory and either the Host is configured with autoDeploy=true the |
483 |
directory and either the Host is configured with autoDeploy=true the |
522 |
Context path must match the directory name or war file name without |
484 |
Context path must match the directory name or war file name without |
523 |
the ".war" extension. |
485 |
the ".war" extension.</p> |
524 |
</blockquote></li> |
486 |
</li> |
525 |
<li><em>Only web applications in the Host web application directory can |
487 |
<li><em>Only web applications in the Host web application directory can |
526 |
be installed</em> |
488 |
be installed</em> |
527 |
<blockquote> |
489 |
<p> |
528 |
If the Host deployXML flag is set to false this error will happen |
490 |
If the Host deployXML flag is set to false this error will happen |
529 |
if an attempt is made to deploy a web application directory or |
491 |
if an attempt is made to deploy a web application directory or |
530 |
".war" file outside of the Host appBase directory. |
492 |
".war" file outside of the Host appBase directory. |
531 |
</blockquote></li> |
493 |
</p></li> |
532 |
</ul> |
494 |
</ul> |
533 |
|
495 |
|
534 |
</subsection> |
496 |
</subsection> |
Lines 535-563
Link Here
|
535 |
|
497 |
|
536 |
<subsection name="List Currently Deployed Applications"> |
498 |
<subsection name="List Currently Deployed Applications"> |
537 |
|
499 |
|
538 |
<source> |
500 |
<source>http://localhost:8080/manager/text/list</source> |
539 |
http://localhost:8080/manager/text/list |
|
|
540 |
</source> |
541 |
|
501 |
|
542 |
<p>List the context paths, current status (<code>running</code> or |
502 |
<p>List the context paths, current status (<code>running</code> or |
543 |
<code>stopped</code>), and number of active sessions for all currently |
503 |
<code>stopped</code>), and number of active sessions for all currently |
544 |
deployed web applications. A typical response immediately |
504 |
deployed web applications. A typical response immediately |
545 |
after starting Tomcat might look like this:</p> |
505 |
after starting Tomcat might look like this:</p> |
546 |
<source> |
506 |
<source>OK - Listed applications for virtual host localhost |
547 |
OK - Listed applications for virtual host localhost |
|
|
548 |
/webdav:running:0 |
507 |
/webdav:running:0 |
549 |
/examples:running:0 |
508 |
/examples:running:0 |
550 |
/manager:running:0 |
509 |
/manager:running:0 |
551 |
/:running:0 |
510 |
/:running:0</source> |
552 |
</source> |
|
|
553 |
|
511 |
|
554 |
</subsection> |
512 |
</subsection> |
555 |
|
513 |
|
556 |
<subsection name="Reload An Existing Application"> |
514 |
<subsection name="Reload An Existing Application"> |
557 |
|
515 |
|
558 |
<source> |
516 |
<source>http://localhost:8080/manager/text/reload?path=/examples</source> |
559 |
http://localhost:8080/manager/text/reload?path=/examples |
|
|
560 |
</source> |
561 |
|
517 |
|
562 |
<p>Signal an existing application to shut itself down and reload. This can |
518 |
<p>Signal an existing application to shut itself down and reload. This can |
563 |
be useful when the web application context is not reloadable and you have |
519 |
be useful when the web application context is not reloadable and you have |
Lines 572-605
Link Here
|
572 |
</p> |
528 |
</p> |
573 |
|
529 |
|
574 |
<p>If this command succeeds, you will see a response like this:</p> |
530 |
<p>If this command succeeds, you will see a response like this:</p> |
575 |
<source> |
531 |
<source>OK - Reloaded application at context path /examples</source> |
576 |
OK - Reloaded application at context path /examples |
|
|
577 |
</source> |
578 |
|
532 |
|
579 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
533 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
580 |
error message. Possible causes for problems include:</p> |
534 |
error message. Possible causes for problems include:</p> |
581 |
<ul> |
535 |
<ul> |
582 |
<li><em>Encountered exception</em> |
536 |
<li><em>Encountered exception</em> |
583 |
<blockquote> |
|
|
584 |
<p>An exception was encountered trying to restart the web application. |
537 |
<p>An exception was encountered trying to restart the web application. |
585 |
Check the Tomcat logs for the details.</p> |
538 |
Check the Tomcat logs for the details.</p> |
586 |
</blockquote></li> |
539 |
</li> |
587 |
<li><em>Invalid context path was specified</em> |
540 |
<li><em>Invalid context path was specified</em> |
588 |
<blockquote> |
|
|
589 |
<p>The context path must start with a slash character. To reference the |
541 |
<p>The context path must start with a slash character. To reference the |
590 |
ROOT web application use "/".</p> |
542 |
ROOT web application use "/".</p> |
591 |
</blockquote></li> |
543 |
</li> |
592 |
<li><em>No context exists for path /foo</em> |
544 |
<li><em>No context exists for path /foo</em> |
593 |
<blockquote> |
|
|
594 |
<p>There is no deployed application on the context path |
545 |
<p>There is no deployed application on the context path |
595 |
that you specified.</p> |
546 |
that you specified.</p> |
596 |
</blockquote></li> |
547 |
</li> |
597 |
<li><em>No context path was specified</em> |
548 |
<li><em>No context path was specified</em> |
598 |
<blockquote> |
549 |
<p> |
599 |
The <code>path</code> parameter is required. |
550 |
The <code>path</code> parameter is required. |
600 |
</blockquote></li> |
551 |
</p></li> |
601 |
<li><em>Reload not supported on WAR deployed at path /foo</em> |
552 |
<li><em>Reload not supported on WAR deployed at path /foo</em> |
602 |
<blockquote> |
553 |
<p> |
603 |
Currently, application reloading (to pick up changes to the classes or |
554 |
Currently, application reloading (to pick up changes to the classes or |
604 |
<code>web.xml</code> file) is not supported when a web application is |
555 |
<code>web.xml</code> file) is not supported when a web application is |
605 |
deployed directly from a WAR file. It only works when the web application |
556 |
deployed directly from a WAR file. It only works when the web application |
Lines 607-613
Link Here
|
607 |
you should <code>undeploy</code> and then <code>deploy</code> or |
558 |
you should <code>undeploy</code> and then <code>deploy</code> or |
608 |
<code>deploy</code> with the <code>update</code> parameter the |
559 |
<code>deploy</code> with the <code>update</code> parameter the |
609 |
application again to pick up your changes. |
560 |
application again to pick up your changes. |
610 |
</blockquote></li> |
561 |
</p></li> |
611 |
</ul> |
562 |
</ul> |
612 |
|
563 |
|
613 |
</subsection> |
564 |
</subsection> |
Lines 614-622
Link Here
|
614 |
|
565 |
|
615 |
<subsection name="List OS and JVM Properties"> |
566 |
<subsection name="List OS and JVM Properties"> |
616 |
|
567 |
|
617 |
<source> |
568 |
<source>http://localhost:8080/manager/text/serverinfo</source> |
618 |
http://localhost:8080/manager/text/serverinfo |
|
|
619 |
</source> |
620 |
|
569 |
|
621 |
<p>Lists information about the Tomcat version, OS, and JVM properties.</p> |
570 |
<p>Lists information about the Tomcat version, OS, and JVM properties.</p> |
622 |
|
571 |
|
Lines 624-633
Link Here
|
624 |
include an error message. Possible causes for problems include:</p> |
573 |
include an error message. Possible causes for problems include:</p> |
625 |
<ul> |
574 |
<ul> |
626 |
<li><em>Encountered exception</em> |
575 |
<li><em>Encountered exception</em> |
627 |
<blockquote> |
|
|
628 |
<p>An exception was encountered trying to enumerate the system properties. |
576 |
<p>An exception was encountered trying to enumerate the system properties. |
629 |
Check the Tomcat logs for the details.</p> |
577 |
Check the Tomcat logs for the details.</p> |
630 |
</blockquote></li> |
578 |
</li> |
631 |
</ul> |
579 |
</ul> |
632 |
|
580 |
|
633 |
</subsection> |
581 |
</subsection> |
Lines 634-642
Link Here
|
634 |
|
582 |
|
635 |
<subsection name="List Available Global JNDI Resources"> |
583 |
<subsection name="List Available Global JNDI Resources"> |
636 |
|
584 |
|
637 |
<source> |
585 |
<source>http://localhost:8080/manager/text/resources[?type=xxxxx]</source> |
638 |
http://localhost:8080/manager/text/resources[?type=xxxxx] |
|
|
639 |
</source> |
640 |
|
586 |
|
641 |
<p>List the global JNDI resources that are available for use in resource |
587 |
<p>List the global JNDI resources that are available for use in resource |
642 |
links for context configuration files. If you specify the <code>type</code> |
588 |
links for context configuration files. If you specify the <code>type</code> |
Lines 648-660
Link Here
|
648 |
|
594 |
|
649 |
<p>Depending on whether the <code>type</code> request parameter is specified |
595 |
<p>Depending on whether the <code>type</code> request parameter is specified |
650 |
or not, the first line of a normal response will be:</p> |
596 |
or not, the first line of a normal response will be:</p> |
651 |
<pre> |
597 |
<source>OK - Listed global resources of all types</source> |
652 |
OK - Listed global resources of all types |
|
|
653 |
</pre> |
654 |
<p>or</p> |
598 |
<p>or</p> |
655 |
<pre> |
599 |
<source>OK - Listed global resources of type xxxxx</source> |
656 |
OK - Listed global resources of type xxxxx |
|
|
657 |
</pre> |
658 |
<p>followed by one line for each resource. Each line is composed of fields |
600 |
<p>followed by one line for each resource. Each line is composed of fields |
659 |
delimited by colon characters (":"), as follows:</p> |
601 |
delimited by colon characters (":"), as follows:</p> |
660 |
<ul> |
602 |
<ul> |
Lines 669-683
Link Here
|
669 |
include an error message. Possible causes for problems include:</p> |
611 |
include an error message. Possible causes for problems include:</p> |
670 |
<ul> |
612 |
<ul> |
671 |
<li><em>Encountered exception</em> |
613 |
<li><em>Encountered exception</em> |
672 |
<blockquote> |
|
|
673 |
<p>An exception was encountered trying to enumerate the global JNDI |
614 |
<p>An exception was encountered trying to enumerate the global JNDI |
674 |
resources. Check the Tomcat logs for the details.</p> |
615 |
resources. Check the Tomcat logs for the details.</p> |
675 |
</blockquote></li> |
616 |
</li> |
676 |
<li><em>No global JNDI resources are available</em> |
617 |
<li><em>No global JNDI resources are available</em> |
677 |
<blockquote> |
|
|
678 |
<p>The Tomcat server you are running has been configured without |
618 |
<p>The Tomcat server you are running has been configured without |
679 |
global JNDI resources.</p> |
619 |
global JNDI resources.</p> |
680 |
</blockquote></li> |
620 |
</li> |
681 |
</ul> |
621 |
</ul> |
682 |
|
622 |
|
683 |
|
623 |
|
Lines 685-693
Link Here
|
685 |
|
625 |
|
686 |
<subsection name="Session Statistics"> |
626 |
<subsection name="Session Statistics"> |
687 |
|
627 |
|
688 |
<source> |
628 |
<source>http://localhost:8080/manager/text/sessions?path=/examples</source> |
689 |
http://localhost:8080/manager/text/sessions?path=/examples |
|
|
690 |
</source> |
691 |
|
629 |
|
692 |
<p>Display the default session timeout for a web application, and the |
630 |
<p>Display the default session timeout for a web application, and the |
693 |
number of currently active sessions that fall within ten-minute ranges of |
631 |
number of currently active sessions that fall within ten-minute ranges of |
Lines 694-704
Link Here
|
694 |
their actual timeout times. For example, after restarting Tomcat and then |
632 |
their actual timeout times. For example, after restarting Tomcat and then |
695 |
executing one of the JSP samples in the <code>/examples</code> web app, |
633 |
executing one of the JSP samples in the <code>/examples</code> web app, |
696 |
you might get something like this:</p> |
634 |
you might get something like this:</p> |
697 |
<source> |
635 |
<source>OK - Session information for application at context path /examples |
698 |
OK - Session information for application at context path /examples |
|
|
699 |
Default maximum session inactive interval 30 minutes |
636 |
Default maximum session inactive interval 30 minutes |
700 |
30 - <40 minutes:1 sessions |
637 |
30 - <40 minutes:1 sessions</source> |
701 |
</source> |
|
|
702 |
|
638 |
|
703 |
</subsection> |
639 |
</subsection> |
704 |
|
640 |
|
Lines 705-713
Link Here
|
705 |
|
641 |
|
706 |
<subsection name="Start an Existing Application"> |
642 |
<subsection name="Start an Existing Application"> |
707 |
|
643 |
|
708 |
<source> |
644 |
<source>http://localhost:8080/manager/text/start?path=/examples</source> |
709 |
http://localhost:8080/manager/text/start?path=/examples |
|
|
710 |
</source> |
711 |
|
645 |
|
712 |
<p>Signal a stopped application to restart, and make itself available again. |
646 |
<p>Signal a stopped application to restart, and make itself available again. |
713 |
Stopping and starting is useful, for example, if the database required by |
647 |
Stopping and starting is useful, for example, if the database required by |
Lines 716-747
Link Here
|
716 |
users continuously encounter database exceptions.</p> |
650 |
users continuously encounter database exceptions.</p> |
717 |
|
651 |
|
718 |
<p>If this command succeeds, you will see a response like this:</p> |
652 |
<p>If this command succeeds, you will see a response like this:</p> |
719 |
<source> |
653 |
<source>OK - Started application at context path /examples</source> |
720 |
OK - Started application at context path /examples |
|
|
721 |
</source> |
722 |
|
654 |
|
723 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
655 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
724 |
error message. Possible causes for problems include:</p> |
656 |
error message. Possible causes for problems include:</p> |
725 |
<ul> |
657 |
<ul> |
726 |
<li><em>Encountered exception</em> |
658 |
<li><em>Encountered exception</em> |
727 |
<blockquote> |
|
|
728 |
<p>An exception was encountered trying to start the web application. |
659 |
<p>An exception was encountered trying to start the web application. |
729 |
Check the Tomcat logs for the details.</p> |
660 |
Check the Tomcat logs for the details.</p> |
730 |
</blockquote></li> |
661 |
</li> |
731 |
<li><em>Invalid context path was specified</em> |
662 |
<li><em>Invalid context path was specified</em> |
732 |
<blockquote> |
|
|
733 |
<p>The context path must start with a slash character. To reference the |
663 |
<p>The context path must start with a slash character. To reference the |
734 |
ROOT web application use "/".</p> |
664 |
ROOT web application use "/".</p> |
735 |
</blockquote></li> |
665 |
</li> |
736 |
<li><em>No context exists for path /foo</em> |
666 |
<li><em>No context exists for path /foo</em> |
737 |
<blockquote> |
|
|
738 |
<p>There is no deployed application on the context path |
667 |
<p>There is no deployed application on the context path |
739 |
that you specified.</p> |
668 |
that you specified.</p> |
740 |
</blockquote></li> |
669 |
</li> |
741 |
<li><em>No context path was specified</em> |
670 |
<li><em>No context path was specified</em> |
742 |
<blockquote> |
671 |
<p> |
743 |
The <code>path</code> parameter is required. |
672 |
The <code>path</code> parameter is required. |
744 |
</blockquote></li> |
673 |
</p></li> |
745 |
</ul> |
674 |
</ul> |
746 |
|
675 |
|
747 |
</subsection> |
676 |
</subsection> |
Lines 748-756
Link Here
|
748 |
|
677 |
|
749 |
<subsection name="Stop an Existing Application"> |
678 |
<subsection name="Stop an Existing Application"> |
750 |
|
679 |
|
751 |
<source> |
680 |
<source>http://localhost:8080/manager/text/stop?path=/examples</source> |
752 |
http://localhost:8080/manager/text/stop?path=/examples |
|
|
753 |
</source> |
754 |
|
681 |
|
755 |
<p>Signal an existing application to make itself unavailable, but leave it |
682 |
<p>Signal an existing application to make itself unavailable, but leave it |
756 |
deployed. Any request that comes in while an application is |
683 |
deployed. Any request that comes in while an application is |
Lines 758-789
Link Here
|
758 |
"stopped" on a list applications command.</p> |
685 |
"stopped" on a list applications command.</p> |
759 |
|
686 |
|
760 |
<p>If this command succeeds, you will see a response like this:</p> |
687 |
<p>If this command succeeds, you will see a response like this:</p> |
761 |
<source> |
688 |
<source>OK - Stopped application at context path /examples</source> |
762 |
OK - Stopped application at context path /examples |
|
|
763 |
</source> |
764 |
|
689 |
|
765 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
690 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
766 |
error message. Possible causes for problems include:</p> |
691 |
error message. Possible causes for problems include:</p> |
767 |
<ul> |
692 |
<ul> |
768 |
<li><em>Encountered exception</em> |
693 |
<li><em>Encountered exception</em> |
769 |
<blockquote> |
|
|
770 |
<p>An exception was encountered trying to stop the web application. |
694 |
<p>An exception was encountered trying to stop the web application. |
771 |
Check the Tomcat logs for the details.</p> |
695 |
Check the Tomcat logs for the details.</p> |
772 |
</blockquote></li> |
696 |
</li> |
773 |
<li><em>Invalid context path was specified</em> |
697 |
<li><em>Invalid context path was specified</em> |
774 |
<blockquote> |
|
|
775 |
<p>The context path must start with a slash character. To reference the |
698 |
<p>The context path must start with a slash character. To reference the |
776 |
ROOT web application use "/".</p> |
699 |
ROOT web application use "/".</p> |
777 |
</blockquote></li> |
700 |
</li> |
778 |
<li><em>No context exists for path /foo</em> |
701 |
<li><em>No context exists for path /foo</em> |
779 |
<blockquote> |
|
|
780 |
<p>There is no deployed application on the context path |
702 |
<p>There is no deployed application on the context path |
781 |
that you specified.</p> |
703 |
that you specified.</p> |
782 |
</blockquote></li> |
704 |
</li> |
783 |
<li><em>No context path was specified</em> |
705 |
<li><em>No context path was specified</em> |
784 |
<blockquote> |
|
|
785 |
The <code>path</code> parameter is required. |
706 |
The <code>path</code> parameter is required. |
786 |
</blockquote></li> |
707 |
</li> |
787 |
</ul> |
708 |
</ul> |
788 |
|
709 |
|
789 |
</subsection> |
710 |
</subsection> |
Lines 791-801
Link Here
|
791 |
|
712 |
|
792 |
<subsection name="Undeploy an Existing Application"> |
713 |
<subsection name="Undeploy an Existing Application"> |
793 |
|
714 |
|
794 |
<source> |
715 |
<source>http://localhost:8080/manager/text/undeploy?path=/examples</source> |
795 |
http://localhost:8080/manager/text/undeploy?path=/examples |
|
|
796 |
</source> |
797 |
|
716 |
|
798 |
<p><strong><font color="red">WARNING</font> - This command will delete any web |
717 |
<p><strong><span style="color: red;">WARNING</span> - This command will delete any web |
799 |
application artifacts that exist within <code>appBase</code> directory |
718 |
application artifacts that exist within <code>appBase</code> directory |
800 |
(typically "webapps") for this virtual host</strong>. |
719 |
(typically "webapps") for this virtual host</strong>. |
801 |
This will delete the the application .WAR, if present, |
720 |
This will delete the the application .WAR, if present, |
Lines 813-844
Link Here
|
813 |
<code>/deploy</code> command.</p> |
732 |
<code>/deploy</code> command.</p> |
814 |
|
733 |
|
815 |
<p>If this command succeeds, you will see a response like this:</p> |
734 |
<p>If this command succeeds, you will see a response like this:</p> |
816 |
<source> |
735 |
<source>OK - Undeployed application at context path /examples</source> |
817 |
OK - Undeployed application at context path /examples |
|
|
818 |
</source> |
819 |
|
736 |
|
820 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
737 |
<p>Otherwise, the response will start with <code>FAIL</code> and include an |
821 |
error message. Possible causes for problems include:</p> |
738 |
error message. Possible causes for problems include:</p> |
822 |
<ul> |
739 |
<ul> |
823 |
<li><em>Encountered exception</em> |
740 |
<li><em>Encountered exception</em> |
824 |
<blockquote> |
|
|
825 |
<p>An exception was encountered trying to undeploy the web application. |
741 |
<p>An exception was encountered trying to undeploy the web application. |
826 |
Check the Tomcat logs for the details.</p> |
742 |
Check the Tomcat logs for the details.</p> |
827 |
</blockquote></li> |
743 |
</li> |
828 |
<li><em>Invalid context path was specified</em> |
744 |
<li><em>Invalid context path was specified</em> |
829 |
<blockquote> |
|
|
830 |
<p>The context path must start with a slash character. To reference the |
745 |
<p>The context path must start with a slash character. To reference the |
831 |
ROOT web application use "/".</p> |
746 |
ROOT web application use "/".</p> |
832 |
</blockquote></li> |
747 |
</li> |
833 |
<li><em>No context exists for path /foo</em> |
748 |
<li><em>No context exists for path /foo</em> |
834 |
<blockquote> |
|
|
835 |
<p>There is no deployed application on the context path |
749 |
<p>There is no deployed application on the context path |
836 |
that you specified.</p> |
750 |
that you specified.</p> |
837 |
</blockquote></li> |
751 |
</li> |
838 |
<li><em>No context path was specified</em> |
752 |
<li><em>No context path was specified</em> |
839 |
<blockquote> |
|
|
840 |
The <code>path</code> parameter is required. |
753 |
The <code>path</code> parameter is required. |
841 |
</blockquote></li> |
754 |
</li> |
842 |
</ul> |
755 |
</ul> |
843 |
|
756 |
|
844 |
</subsection> |
757 |
</subsection> |
Lines 845-853
Link Here
|
845 |
|
758 |
|
846 |
<subsection name="Finding memory leaks"> |
759 |
<subsection name="Finding memory leaks"> |
847 |
|
760 |
|
848 |
<source> |
761 |
<source>http://localhost:8080/manager/text/findleaks[?statusLine=[true|false]]</source> |
849 |
http://localhost:8080/manager/text/findleaks[?statusLine=[true|false]] |
|
|
850 |
</source> |
851 |
|
762 |
|
852 |
<p><strong>The find leaks diagnostic triggers a full garbage collection. It |
763 |
<p><strong>The find leaks diagnostic triggers a full garbage collection. It |
853 |
should be used with extreme caution on production systems.</strong></p> |
764 |
should be used with extreme caution on production systems.</strong></p> |
Lines 866-874
Link Here
|
866 |
GC, you will need to check using tools like GC logging, JConsole or similar.</p> |
777 |
GC, you will need to check using tools like GC logging, JConsole or similar.</p> |
867 |
|
778 |
|
868 |
<p>If this command succeeds, you will see a response like this:</p> |
779 |
<p>If this command succeeds, you will see a response like this:</p> |
869 |
<source> |
780 |
<source>/leaking-webapp</source> |
870 |
/leaking-webapp |
|
|
871 |
</source> |
872 |
|
781 |
|
873 |
<p>If you wish to see a status line included in the response then include the |
782 |
<p>If you wish to see a status line included in the response then include the |
874 |
<code>statusLine</code> query parameter in the request with a value of |
783 |
<code>statusLine</code> query parameter in the request with a value of |
Lines 886-894
Link Here
|
886 |
|
795 |
|
887 |
<subsection name="Connector SSL diagnostics"> |
796 |
<subsection name="Connector SSL diagnostics"> |
888 |
|
797 |
|
889 |
<source> |
798 |
<source>http://localhost:8080/manager/text/sslConnectorCiphers</source> |
890 |
http://localhost:8080/manager/text/sslConnectorCiphers |
|
|
891 |
</source> |
892 |
|
799 |
|
893 |
<p>The SSL Connector/Ciphers diagnostic lists the SSL ciphers that are currently |
800 |
<p>The SSL Connector/Ciphers diagnostic lists the SSL ciphers that are currently |
894 |
configured for each connector. For BIO and NIO, the names of the individual |
801 |
configured for each connector. For BIO and NIO, the names of the individual |
Lines 895-902
Link Here
|
895 |
cipher suites are listed. For APR, the value of SSLCipherSuite is returned.</p> |
802 |
cipher suites are listed. For APR, the value of SSLCipherSuite is returned.</p> |
896 |
|
803 |
|
897 |
<p>The response will ook something like this:</p> |
804 |
<p>The response will ook something like this:</p> |
898 |
<source> |
805 |
<source>OK - Connector / SSL Cipher information |
899 |
OK - Connector / SSL Cipher information |
|
|
900 |
Connector[HTTP/1.1-8080] |
806 |
Connector[HTTP/1.1-8080] |
901 |
SSL is not enabled for this connector |
807 |
SSL is not enabled for this connector |
902 |
Connector[HTTP/1.1-8443] |
808 |
Connector[HTTP/1.1-8443] |
Lines 904-911
Link Here
|
904 |
TLS_DHE_RSA_WITH_AES_128_CBC_SHA |
810 |
TLS_DHE_RSA_WITH_AES_128_CBC_SHA |
905 |
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA |
811 |
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA |
906 |
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA |
812 |
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA |
907 |
... |
813 |
...</source> |
908 |
</source> |
|
|
909 |
|
814 |
|
910 |
</subsection> |
815 |
</subsection> |
911 |
|
816 |
|
Lines 982-1038
Link Here
|
982 |
<code><taskdef></code> element. Therefore, your <code>build.xml</code> |
887 |
<code><taskdef></code> element. Therefore, your <code>build.xml</code> |
983 |
file might look something like this:</p> |
888 |
file might look something like this:</p> |
984 |
|
889 |
|
985 |
<table border="1"> |
890 |
<source><![CDATA[<project name="My Application" default="compile" basedir="."> |
986 |
<tr><td><pre> |
|
|
987 |
<project name="My Application" default="compile" basedir="."> |
988 |
|
891 |
|
989 |
<!-- Configure the directory into which the web application is built --> |
892 |
<!-- Configure the directory into which the web application is built --> |
990 |
<property name="build" value="${basedir}/build"/> |
893 |
<property name="build" value="${basedir}/build"/> |
991 |
|
894 |
|
992 |
<!-- Configure the context path for this application --> |
895 |
<!-- Configure the context path for this application --> |
993 |
<property name="path" value="/myapp"/> |
896 |
<property name="path" value="/myapp"/> |
994 |
|
897 |
|
995 |
<!-- Configure properties to access the Manager application --> |
898 |
<!-- Configure properties to access the Manager application --> |
996 |
<property name="url" value="http://localhost:8080/manager/text"/> |
899 |
<property name="url" value="http://localhost:8080/manager/text"/> |
997 |
<property name="username" value="myusername"/> |
900 |
<property name="username" value="myusername"/> |
998 |
<property name="password" value="mypassword"/> |
901 |
<property name="password" value="mypassword"/> |
999 |
|
902 |
|
1000 |
<!-- Configure the custom Ant tasks for the Manager application --> |
903 |
<!-- Configure the custom Ant tasks for the Manager application --> |
1001 |
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> |
904 |
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> |
1002 |
<taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> |
905 |
<taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> |
1003 |
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> |
906 |
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> |
1004 |
<taskdef name="findleaks" classname="org.apache.catalina.ant.FindLeaksTask"/> |
907 |
<taskdef name="findleaks" classname="org.apache.catalina.ant.FindLeaksTask"/> |
1005 |
<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/> |
908 |
<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/> |
1006 |
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"/> |
909 |
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"/> |
1007 |
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/> |
910 |
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/> |
1008 |
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> |
911 |
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> |
1009 |
|
912 |
|
1010 |
<!-- Executable Targets --> |
913 |
<!-- Executable Targets --> |
1011 |
<target name="compile" description="Compile web application"> |
914 |
<target name="compile" description="Compile web application"> |
1012 |
<!-- ... construct web application in ${build} subdirectory, and |
915 |
<!-- ... construct web application in ${build} subdirectory, and |
1013 |
generated a ${path}.war ... --> |
916 |
generated a ${path}.war ... --> |
1014 |
</target> |
917 |
</target> |
1015 |
|
918 |
|
1016 |
<target name="deploy" description="Install web application" |
919 |
<target name="deploy" description="Install web application" |
1017 |
depends="compile"> |
920 |
depends="compile"> |
1018 |
<deploy url="${url}" username="${username}" password="${password}" |
921 |
<deploy url="${url}" username="${username}" password="${password}" |
1019 |
path="${path}" war="file:${build}${path}.war"/> |
922 |
path="${path}" war="file:${build}${path}.war"/> |
1020 |
</target> |
923 |
</target> |
1021 |
|
924 |
|
1022 |
<target name="reload" description="Reload web application" |
925 |
<target name="reload" description="Reload web application" |
1023 |
depends="compile"> |
926 |
depends="compile"> |
1024 |
<reload url="${url}" username="${username}" password="${password}" |
927 |
<reload url="${url}" username="${username}" password="${password}" |
1025 |
path="${path}"/> |
928 |
path="${path}"/> |
1026 |
</target> |
929 |
</target> |
1027 |
|
930 |
|
1028 |
<target name="undeploy" description="Remove web application"> |
931 |
<target name="undeploy" description="Remove web application"> |
1029 |
<undeploy url="${url}" username="${username}" password="${password}" |
932 |
<undeploy url="${url}" username="${username}" password="${password}" |
1030 |
path="${path}"/> |
933 |
path="${path}"/> |
1031 |
</target> |
934 |
</target> |
1032 |
|
935 |
|
1033 |
</project> |
936 |
</project>]]></source> |
1034 |
</pre></td></tr> |
|
|
1035 |
</table> |
1036 |
|
937 |
|
1037 |
<p>Note: The definition of the resources task above will override the resources |
938 |
<p>Note: The definition of the resources task above will override the resources |
1038 |
datatype added in Ant 1.7. If you wish to use the resources datatype you will |
939 |
datatype added in Ant 1.7. If you wish to use the resources datatype you will |
Lines 1047-1055
Link Here
|
1047 |
consider it a security risk to include the real manager password in your |
948 |
consider it a security risk to include the real manager password in your |
1048 |
<code>build.xml</code> file's source code. To avoid this, omit the password |
949 |
<code>build.xml</code> file's source code. To avoid this, omit the password |
1049 |
property, and specify it from the command line:</p> |
950 |
property, and specify it from the command line:</p> |
1050 |
<pre> |
951 |
<source>ant -Dpassword=secret deploy</source> |
1051 |
ant -Dpassword=secret deploy |
|
|
1052 |
</pre> |
1053 |
|
952 |
|
1054 |
<subsection name="Tasks output capture"> |
953 |
<subsection name="Tasks output capture"> |
1055 |
|
954 |
|
Lines 1059-1153
Link Here
|
1059 |
<code><redirector></code> type attributes: |
958 |
<code><redirector></code> type attributes: |
1060 |
</p> |
959 |
</p> |
1061 |
|
960 |
|
1062 |
<table border="1" cellpadding="2" cellspacing="0"> |
961 |
<table class="defaultTable"> |
1063 |
<tbody> |
|
|
1064 |
<tr> |
962 |
<tr> |
1065 |
<td valign="top"><b>Attribute</b></td> |
963 |
<th>Attribute</th> |
1066 |
<td valign="top"><b>Description</b></td> |
964 |
<th>Description</th> |
1067 |
<td align="center" valign="top"><b>Required</b></td> |
965 |
<th style="text-align: center;">Required</th> |
1068 |
</tr> |
966 |
</tr> |
1069 |
<tr> |
967 |
<tr> |
1070 |
<td valign="top">output</td> |
968 |
<td>output</td> |
1071 |
<td valign="top">Name of a file to which to write the output. If |
969 |
<td>Name of a file to which to write the output. If |
1072 |
the error stream is not also redirected to a file or property, it will |
970 |
the error stream is not also redirected to a file or property, it will |
1073 |
appear in this output.</td> |
971 |
appear in this output.</td> |
1074 |
<td align="center" valign="top">No</td> |
972 |
<td style="text-align: center;">No</td> |
1075 |
</tr> |
973 |
</tr> |
1076 |
<tr> |
974 |
<tr> |
1077 |
<td valign="top">error</td> |
975 |
<td>error</td> |
1078 |
<td valign="top">The file to which the standard error of the |
976 |
<td>The file to which the standard error of the |
1079 |
command should be redirected.</td> |
977 |
command should be redirected.</td> |
1080 |
<td align="center" valign="top">No</td> |
978 |
<td style="text-align: center;">No</td> |
1081 |
</tr> |
979 |
</tr> |
1082 |
<tr> |
980 |
<tr> |
1083 |
<td valign="top">logError</td> |
981 |
<td>logError</td> |
1084 |
<td valign="top">This attribute is used when you wish to see |
982 |
<td>This attribute is used when you wish to see |
1085 |
error output in Ant's log and you are redirecting output to a |
983 |
error output in Ant's log and you are redirecting output to a |
1086 |
file/property. The error output will not be included in the output |
984 |
file/property. The error output will not be included in the output |
1087 |
file/property. If you redirect error with the <i>error</i> or <i>errorProperty</i> |
985 |
file/property. If you redirect error with the <i>error</i> or <i>errorProperty</i> |
1088 |
attributes, this will have no effect.</td> |
986 |
attributes, this will have no effect.</td> |
1089 |
<td align="center" valign="top">No</td> |
987 |
<td style="text-align: center;">No</td> |
1090 |
</tr> |
988 |
</tr> |
1091 |
<tr> |
989 |
<tr> |
1092 |
<td valign="top">append</td> |
990 |
<td>append</td> |
1093 |
<td valign="top">Whether output and error files should be |
991 |
<td>Whether output and error files should be |
1094 |
appended to or overwritten. Defaults to <code>false</code>.</td> |
992 |
appended to or overwritten. Defaults to <code>false</code>.</td> |
1095 |
<td align="center" valign="top">No</td> |
993 |
<td style="text-align: center;">No</td> |
1096 |
</tr> |
994 |
</tr> |
1097 |
<tr> |
995 |
<tr> |
1098 |
<td valign="top">createemptyfiles</td> |
996 |
<td>createemptyfiles</td> |
1099 |
<td valign="top">Whether output and error files should be created |
997 |
<td>Whether output and error files should be created |
1100 |
even when empty. Defaults to <code>true</code>.</td> |
998 |
even when empty. Defaults to <code>true</code>.</td> |
1101 |
<td align="center" valign="top">No</td> |
999 |
<td style="text-align: center;">No</td> |
1102 |
</tr> |
1000 |
</tr> |
1103 |
<tr> |
1001 |
<tr> |
1104 |
<td valign="top">outputproperty</td> |
1002 |
<td>outputproperty</td> |
1105 |
<td valign="top">The name of a property in which the output of |
1003 |
<td>The name of a property in which the output of |
1106 |
the command should be stored. Unless the error stream is redirected to |
1004 |
the command should be stored. Unless the error stream is redirected to |
1107 |
a separate file or stream, this property will include the error output.</td> |
1005 |
a separate file or stream, this property will include the error output.</td> |
1108 |
<td align="center" valign="top">No</td> |
1006 |
<td style="text-align: center;">No</td> |
1109 |
</tr> |
1007 |
</tr> |
1110 |
<tr> |
1008 |
<tr> |
1111 |
<td valign="top">errorproperty</td> |
1009 |
<td>errorproperty</td> |
1112 |
<td valign="top">The name of a property in which the standard |
1010 |
<td>The name of a property in which the standard |
1113 |
error of the command should be stored.</td> |
1011 |
error of the command should be stored.</td> |
1114 |
<td align="center" valign="top">No</td> |
1012 |
<td style="text-align: center;">No</td> |
1115 |
</tr> |
1013 |
</tr> |
1116 |
</tbody> |
|
|
1117 |
</table> |
1014 |
</table> |
1118 |
|
1015 |
|
1119 |
<p>A couple of additional attributes can also be specified: |
1016 |
<p>A couple of additional attributes can also be specified: |
1120 |
</p> |
1017 |
</p> |
1121 |
<table border="1" cellpadding="2" cellspacing="0"> |
1018 |
<table class="defaultTable"> |
1122 |
<tbody> |
|
|
1123 |
<tr> |
1019 |
<tr> |
1124 |
<td valign="top"><b>Attribute</b></td> |
1020 |
<th>Attribute</th> |
1125 |
<td valign="top"><b>Description</b></td> |
1021 |
<th>Description</th> |
1126 |
<td align="center" valign="top"><b>Required</b></td> |
1022 |
<th style="text-align: center;">Required</th> |
1127 |
</tr> |
1023 |
</tr> |
1128 |
<tr> |
1024 |
<tr> |
1129 |
<td valign="top">alwaysLog</td> |
1025 |
<td>alwaysLog</td> |
1130 |
<td valign="top">This attribute is used when you wish to see the |
1026 |
<td>This attribute is used when you wish to see the |
1131 |
output you are capturing, appearing also in the Ant's log. It must not be |
1027 |
output you are capturing, appearing also in the Ant's log. It must not be |
1132 |
used unless you are capturing task output. |
1028 |
used unless you are capturing task output. |
1133 |
Defaults to <code>false</code>. |
1029 |
Defaults to <code>false</code>. |
1134 |
<em>This attribute will be supported directly by <code><redirector></code> |
1030 |
<em>This attribute will be supported directly by <code><redirector></code> |
1135 |
in Ant 1.6.3</em></td> |
1031 |
in Ant 1.6.3</em></td> |
1136 |
<td align="center" valign="top">No</td> |
1032 |
<td style="text-align: center;">No</td> |
1137 |
</tr> |
1033 |
</tr> |
1138 |
<tr> |
1034 |
<tr> |
1139 |
<td valign="top">failonerror</td> |
1035 |
<td>failonerror</td> |
1140 |
<td valign="top">This attribute is used when you wish to avoid that |
1036 |
<td>This attribute is used when you wish to avoid that |
1141 |
any manager command processing error terminates the ant execution. Defaults to <code>true</code>. |
1037 |
any manager command processing error terminates the ant execution. Defaults to <code>true</code>. |
1142 |
It must be set to <code>false</code>, if you want to capture error output, |
1038 |
It must be set to <code>false</code>, if you want to capture error output, |
1143 |
otherwise execution will terminate before anything can be captured. |
1039 |
otherwise execution will terminate before anything can be captured. |
1144 |
<br></br> |
1040 |
<br/> |
1145 |
This attribute acts only on manager command execution, |
1041 |
This attribute acts only on manager command execution, |
1146 |
any wrong or missing command attribute will still cause Ant execution termination. |
1042 |
any wrong or missing command attribute will still cause Ant execution termination. |
1147 |
</td> |
1043 |
</td> |
1148 |
<td align="center" valign="top">No</td> |
1044 |
<td style="text-align: center;">No</td> |
1149 |
</tr> |
1045 |
</tr> |
1150 |
</tbody> |
|
|
1151 |
</table> |
1046 |
</table> |
1152 |
|
1047 |
|
1153 |
<p>They also support the embedded <code><redirector></code> element |
1048 |
<p>They also support the embedded <code><redirector></code> element |
Lines 1164-1236
Link Here
|
1164 |
can be used: |
1059 |
can be used: |
1165 |
</p> |
1060 |
</p> |
1166 |
|
1061 |
|
1167 |
<table border="1"> |
1062 |
<source><![CDATA[ <target name="manager.deploy" |
1168 |
<tr><td><pre> |
|
|
1169 |
<target name="manager.deploy" |
1170 |
depends="context.status" |
1063 |
depends="context.status" |
1171 |
if="context.notInstalled"> |
1064 |
if="context.notInstalled"> |
1172 |
<deploy url="${mgr.url}" |
1065 |
<deploy url="${mgr.url}" |
1173 |
username="${mgr.username}" |
1066 |
username="${mgr.username}" |
1174 |
password="${mgr.password}" |
1067 |
password="${mgr.password}" |
1175 |
path="${mgr.context.path}" |
1068 |
path="${mgr.context.path}" |
1176 |
config="${mgr.context.descriptor}"/> |
1069 |
config="${mgr.context.descriptor}"/> |
1177 |
</target> |
1070 |
</target> |
1178 |
|
1071 |
|
1179 |
<target name="manager.deploy.war" |
1072 |
<target name="manager.deploy.war" |
1180 |
depends="context.status" |
1073 |
depends="context.status" |
1181 |
if="context.deployable"> |
1074 |
if="context.deployable"> |
1182 |
<deploy url="${mgr.url}" |
1075 |
<deploy url="${mgr.url}" |
1183 |
username="${mgr.username}" |
1076 |
username="${mgr.username}" |
1184 |
password="${mgr.password}" |
1077 |
password="${mgr.password}" |
1185 |
update="${mgr.update}" |
1078 |
update="${mgr.update}" |
1186 |
path="${mgr.context.path}" |
1079 |
path="${mgr.context.path}" |
1187 |
war="${mgr.war.file}"/> |
1080 |
war="${mgr.war.file}"/> |
1188 |
</target> |
1081 |
</target> |
1189 |
|
1082 |
|
1190 |
<target name="context.status"> |
1083 |
<target name="context.status"> |
1191 |
<property name="running" value="${mgr.context.path}:running"/> |
1084 |
<property name="running" value="${mgr.context.path}:running"/> |
1192 |
<property name="stopped" value="${mgr.context.path}:stopped"/> |
1085 |
<property name="stopped" value="${mgr.context.path}:stopped"/> |
1193 |
|
1086 |
|
1194 |
<list url="${mgr.url}" |
1087 |
<list url="${mgr.url}" |
1195 |
outputproperty="ctx.status" |
1088 |
outputproperty="ctx.status" |
1196 |
username="${mgr.username}" |
1089 |
username="${mgr.username}" |
1197 |
password="${mgr.password}"> |
1090 |
password="${mgr.password}"> |
1198 |
</list> |
1091 |
</list> |
1199 |
|
1092 |
|
1200 |
<condition property="context.running"> |
1093 |
<condition property="context.running"> |
1201 |
<contains string="${ctx.status}" substring="${running}"/> |
1094 |
<contains string="${ctx.status}" substring="${running}"/> |
1202 |
</condition> |
1095 |
</condition> |
1203 |
<condition property="context.stopped"> |
1096 |
<condition property="context.stopped"> |
1204 |
<contains string="${ctx.status}" substring="${stopped}"/> |
1097 |
<contains string="${ctx.status}" substring="${stopped}"/> |
1205 |
</condition> |
1098 |
</condition> |
1206 |
<condition property="context.notInstalled"> |
1099 |
<condition property="context.notInstalled"> |
1207 |
<and> |
1100 |
<and> |
1208 |
<isfalse value="${context.running}"/> |
1101 |
<isfalse value="${context.running}"/> |
1209 |
<isfalse value="${context.stopped}"/> |
1102 |
<isfalse value="${context.stopped}"/> |
1210 |
</and> |
1103 |
</and> |
1211 |
</condition> |
1104 |
</condition> |
1212 |
<condition property="context.deployable"> |
1105 |
<condition property="context.deployable"> |
1213 |
<or> |
1106 |
<or> |
1214 |
<istrue value="${context.notInstalled}"/> |
1107 |
<istrue value="${context.notInstalled}"/> |
1215 |
<and> |
1108 |
<and> |
1216 |
<istrue value="${context.running}"/> |
1109 |
<istrue value="${context.running}"/> |
1217 |
<istrue value="${mgr.update}"/> |
1110 |
<istrue value="${mgr.update}"/> |
1218 |
</and> |
1111 |
</and> |
1219 |
<and> |
1112 |
<and> |
1220 |
<istrue value="${context.stopped}"/> |
1113 |
<istrue value="${context.stopped}"/> |
1221 |
<istrue value="${mgr.update}"/> |
1114 |
<istrue value="${mgr.update}"/> |
1222 |
</and> |
1115 |
</and> |
1223 |
</or> |
1116 |
</or> |
1224 |
</condition> |
1117 |
</condition> |
1225 |
<condition property="context.undeployable"> |
1118 |
<condition property="context.undeployable"> |
1226 |
<or> |
1119 |
<or> |
1227 |
<istrue value="${context.running}"/> |
1120 |
<istrue value="${context.running}"/> |
1228 |
<istrue value="${context.stopped}"/> |
1121 |
<istrue value="${context.stopped}"/> |
1229 |
</or> |
1122 |
</or> |
1230 |
</condition> |
1123 |
</condition> |
1231 |
</target> |
1124 |
</target>]]></source> |
1232 |
</pre></td></tr> |
|
|
1233 |
</table> |
1234 |
|
1125 |
|
1235 |
<p><strong>WARNING:</strong> even if it doesn't make many sense, and is always a bad idea, |
1126 |
<p><strong>WARNING:</strong> even if it doesn't make many sense, and is always a bad idea, |
1236 |
calling a Catalina task more than once, |
1127 |
calling a Catalina task more than once, |
Lines 1265-1276
Link Here
|
1265 |
</subsection> |
1156 |
</subsection> |
1266 |
|
1157 |
|
1267 |
<subsection name="JMX Query command"> |
1158 |
<subsection name="JMX Query command"> |
1268 |
This takes the form: |
1159 |
<p>This takes the form:</p> |
1269 |
<source> |
1160 |
<source>http://webserver/manager/jmxproxy/?qry=STUFF</source> |
1270 |
http://webserver/manager/jmxproxy/?qry=STUFF |
1161 |
<p>Where <code>STUFF</code> is the JMX query you wish to perform. For example, |
1271 |
</source> |
1162 |
here are some queries you might wish to run:</p> |
1272 |
Where <code>STUFF</code> is the JMX query you wish to perform. For example, |
|
|
1273 |
here are some queries you might wish to run: |
1274 |
<ul> |
1163 |
<ul> |
1275 |
<li> |
1164 |
<li> |
1276 |
<code>qry=*%3Atype%3DRequestProcessor%2C* --> |
1165 |
<code>qry=*%3Atype%3DRequestProcessor%2C* --> |
Lines 1288-1383
Link Here
|
1288 |
which look for a specific MBean by the given name. |
1177 |
which look for a specific MBean by the given name. |
1289 |
</li> |
1178 |
</li> |
1290 |
</ul> |
1179 |
</ul> |
|
|
1180 |
<p> |
1291 |
You'll need to experiment with this to really understand its capabilites. |
1181 |
You'll need to experiment with this to really understand its capabilites. |
1292 |
If you provide no <code>qry</code> parameter, then all of the MBeans will |
1182 |
If you provide no <code>qry</code> parameter, then all of the MBeans will |
1293 |
be displayed. We really recommend looking at the tomcat source code and |
1183 |
be displayed. We really recommend looking at the tomcat source code and |
1294 |
understand the JMX spec to get a better understanding of all the queries |
1184 |
understand the JMX spec to get a better understanding of all the queries |
1295 |
you may run. |
1185 |
you may run. |
|
|
1186 |
</p> |
1296 |
</subsection> |
1187 |
</subsection> |
1297 |
|
1188 |
|
1298 |
<subsection name="JMX Get command"> |
1189 |
<subsection name="JMX Get command"> |
|
|
1190 |
<p> |
1299 |
The JXMProxyServlet also supports a "get" command that you can use to |
1191 |
The JXMProxyServlet also supports a "get" command that you can use to |
1300 |
fetch the value of a specific MBean's attribute. The general form of |
1192 |
fetch the value of a specific MBean's attribute. The general form of |
1301 |
the <code>get</code> command is: |
1193 |
the <code>get</code> command is: |
|
|
1194 |
</p> |
1302 |
|
1195 |
|
1303 |
<source> |
1196 |
<source>http://webserver/manager/jmxproxy/?get=BEANNAME&att=MYATTRIBUTE&key=MYKEY</source> |
1304 |
http://webserver/manager/jmxproxy/?get=BEANNAME&att=MYATTRIBUTE&key=MYKEY |
|
|
1305 |
</source> |
1306 |
|
1197 |
|
1307 |
You must provide the following parameters: |
1198 |
<p>You must provide the following parameters:</p> |
1308 |
<ol> |
1199 |
<ol> |
1309 |
<li><code>get</code>: The full bean name</li> |
1200 |
<li><code>get</code>: The full bean name</li> |
1310 |
<li><code>att</code>: The attribute you wish to fetch</li> |
1201 |
<li><code>att</code>: The attribute you wish to fetch</li> |
1311 |
<li><code>key</code>: (optional) The key into a CompositeData MBean attribute</li> |
1202 |
<li><code>key</code>: (optional) The key into a CompositeData MBean attribute</li> |
1312 |
</ol> |
1203 |
</ol> |
1313 |
|
1204 |
<p> |
1314 |
If all goes well, then it will say OK, otherwise an error message will |
1205 |
If all goes well, then it will say OK, otherwise an error message will |
1315 |
be shown. For example, let's say we wish to fetch the current heap memory |
1206 |
be shown. For example, let's say we wish to fetch the current heap memory |
1316 |
data: |
1207 |
data: |
|
|
1208 |
</p> |
1317 |
|
1209 |
|
1318 |
<source> |
1210 |
<source>http://webserver/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage</source> |
1319 |
http://webserver/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage |
|
|
1320 |
</source> |
1321 |
|
1211 |
|
1322 |
Or, if you only want the "used" key: |
1212 |
<p>Or, if you only want the "used" key:</p> |
1323 |
|
1213 |
|
1324 |
<source> |
1214 |
<source>http://webserver/manager/jmxproxy/ |
1325 |
http://webserver/manager/jmxproxy/ |
1215 |
?get=java.lang:type=Memory&att=HeapMemoryUsage&key=used</source> |
1326 |
?get=java.lang:type=Memory&att=HeapMemoryUsage&key=used |
|
|
1327 |
</source> |
1328 |
</subsection> |
1216 |
</subsection> |
1329 |
|
1217 |
|
1330 |
<subsection name="JMX Set command"> |
1218 |
<subsection name="JMX Set command"> |
|
|
1219 |
<p> |
1331 |
Now that you can query an MBean, its time to muck with Tomcat's internals! |
1220 |
Now that you can query an MBean, its time to muck with Tomcat's internals! |
1332 |
The general form of the set command is : |
1221 |
The general form of the set command is : |
1333 |
<source> |
1222 |
</p> |
1334 |
http://webserver/manager/jmxproxy/?set=BEANNAME&att=MYATTRIBUTE&val=NEWVALUE |
1223 |
<source>http://webserver/manager/jmxproxy/?set=BEANNAME&att=MYATTRIBUTE&val=NEWVALUE</source> |
1335 |
</source> |
1224 |
<p>So you need to provide 3 request parameters:</p> |
1336 |
So you need to provide 3 request parameters: |
|
|
1337 |
<ol> |
1225 |
<ol> |
1338 |
<li><code>set</code>: The full bean name</li> |
1226 |
<li><code>set</code>: The full bean name</li> |
1339 |
<li><code>att</code>: The attribute you wish to alter</li> |
1227 |
<li><code>att</code>: The attribute you wish to alter</li> |
1340 |
<li><code>val</code>: The new value </li> |
1228 |
<li><code>val</code>: The new value </li> |
1341 |
</ol> |
1229 |
</ol> |
|
|
1230 |
<p> |
1342 |
If all goes ok, then it will say OK, otherwise an error message will be |
1231 |
If all goes ok, then it will say OK, otherwise an error message will be |
1343 |
shown. For example, lets say we wish to turn up debugging on the fly for the |
1232 |
shown. For example, lets say we wish to turn up debugging on the fly for the |
1344 |
<code>ErrorReportValve</code>. The following will set debugging to 10. |
1233 |
<code>ErrorReportValve</code>. The following will set debugging to 10. |
1345 |
<source> |
1234 |
</p> |
1346 |
http://localhost:8080/manager/jmxproxy/ |
1235 |
<source>http://localhost:8080/manager/jmxproxy/ |
1347 |
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost |
1236 |
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost |
1348 |
&att=debug&val=10 |
1237 |
&att=debug&val=10</source> |
1349 |
</source> |
1238 |
<p>and my result is (YMMV):</p> |
1350 |
and my result is (YMMV): |
1239 |
<source>Result: ok</source> |
1351 |
<source> |
|
|
1352 |
Result: ok |
1353 |
</source> |
1354 |
|
1240 |
|
1355 |
Here is what I see if I pass in a bad value. Here is the URL I used, |
1241 |
<p>Here is what I see if I pass in a bad value. Here is the URL I used, |
1356 |
I try set debugging equal to 'cow': |
1242 |
I try set debugging equal to 'cow':</p> |
1357 |
<source> |
1243 |
<source>http://localhost:8080/manager/jmxproxy/ |
1358 |
http://localhost:8080/manager/jmxproxy/ |
|
|
1359 |
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost |
1244 |
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost |
1360 |
&att=debug&val=cow |
1245 |
&att=debug&val=cow</source> |
1361 |
</source> |
1246 |
<p>When I try that, my result is</p> |
1362 |
When I try that, my result is |
1247 |
<source>Error: java.lang.NumberFormatException: For input string: "cow"</source> |
1363 |
<source> |
|
|
1364 |
Error: java.lang.NumberFormatException: For input string: "cow" |
1365 |
</source> |
1366 |
</subsection> |
1248 |
</subsection> |
1367 |
|
1249 |
|
1368 |
<subsection name="JMX Invoke command"> |
1250 |
<subsection name="JMX Invoke command"> |
1369 |
<p>The <code>invoke</code> command enables methods to be called on MBeans. The |
1251 |
<p>The <code>invoke</code> command enables methods to be called on MBeans. The |
1370 |
general form of the command is:</p> |
1252 |
general form of the command is:</p> |
1371 |
<source> |
1253 |
<source>http://webserver/manager/jmxproxy/ |
1372 |
http://webserver/manager/jmxproxy/ |
1254 |
?invoke=BEANNAME&op=METHODNAME&ps=COMMASEPARATEDPARAMETERS</source> |
1373 |
?invoke=BEANNAME&op=METHODNAME&ps=COMMASEPARATEDPARAMETERS |
|
|
1374 |
</source> |
1375 |
<p>For example, to call the <code>findConnectors()</code> method of the |
1255 |
<p>For example, to call the <code>findConnectors()</code> method of the |
1376 |
<strong>Service</strong> use:</p> |
1256 |
<strong>Service</strong> use:</p> |
1377 |
<source> |
1257 |
<source>http://localhost:8080/manager/jmxproxy/ |
1378 |
http://localhost:8080/manager/jmxproxy/ |
1258 |
?invoke=Catalina%3Atype%3DService&op=findConnectors&ps=</source> |
1379 |
?invoke=Catalina%3Atype%3DService&op=findConnectors&ps= |
|
|
1380 |
</source> |
1381 |
</subsection> |
1259 |
</subsection> |
1382 |
</section> |
1260 |
</section> |
1383 |
|
1261 |
|