source: nutchez-0.1/tomcat/webapps/docs/monitoring.html @ 186

Last change on this file since 186 was 66, checked in by waue, 16 years ago

NutchEz - an easy way to nutch

File size: 62.8 KB
Line 
1<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Monitoring and Managing Tomcat</title><meta value="Peter Rossbach" name="author"><meta value="pero@apache.org" name="email"><meta value="Remy Maucherat" name="author"><meta value="remm@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>Monitoring and Managing Tomcat</h2></td><td nowrap="true" valign="top" align="right"><small><a href="printer/monitoring.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="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
5
6  <p>Monitoring is a very important question today. Looking inside the running
7        server, grab some statistic data or reconfigure some aspects are
8        daliy adminstration tasks.</p> 
9 
10  </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Enabling JMX Remote"><strong>Enabling JMX Remote</strong></a></font></td></tr><tr><td><blockquote>
11
12    <p>The Sun website includes the list of options and how to configure JMX Remote on Java 5:
13        <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html">
14        http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html</a>.
15    </p>
16    <p>For quick installation you find here a short installation guide:</p>
17    <p>Add the following parameters to your tomcat startup script:
18    <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>
19    set CATALINA_OPTS="-Dcom.sun.management.jmxremote \
20    -Dcom.sun.management.jmxremote.port=%my.jmx.port% \
21    -Dcom.sun.management.jmxremote.ssl=false \
22    -Dcom.sun.management.jmxremote.authenticate=false"
23    </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>
24    </p>
25    <p>
26    <ol>
27    <li>When you think authorisation is a good, add and change this :
28    <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>
29    -Dcom.sun.management.jmxremote.authenticate=true \
30    -Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password \
31    -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access \
32    </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>
33    </li>
34    <li>edit the access allow file <em>$CATALINA_BASE/conf/jmxremote.access</em> :
35    <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>
36monitorRole readonly
37controlRole readwrite
38    </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>
39    </li>
40    <li>edit the password file <em>$CATALINA_BASE/conf/jmxremote.password</em> :
41    <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>
42monitorRole tomcat
43controlRole tomcat
44    </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>
45    <b>Tipp</b>: Password File must be readonly and not accessable from every
46    other user! Remove all other users under windows to access this file.
47    </li>
48    </ol>
49    <b>Note:</b>The JSR 160 JMX-Adaptor opens a second data protocol port. That is a problem
50    when you have installed a local firewall.<br>
51    </p>
52    <p>Activate JMX MX4J Http Adaptor with Java 1.4:
53    <ol>
54      <li>Install the tomcat compat package</li>
55      <li>Install the mx4j-tools.jar at common/lib. Please, use the same MX4j
56          version as your tomcat release</li>
57      <li>Configure a MX4J JMX HTTP Adaptor at your AJP Connector
58      <p>
59      <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>
60      &lt;Connector port="${AJP.PORT}"
61            handler.list="mx"
62            mx.enabled="true"
63            mx.httpHost="${JMX.HOST}"
64            mx.httpPort="${JMX.PORT}"
65            protocol="AJP/1.3" /&gt;
66      </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>
67      </p>
68      <p><b>Tipp</b>: With <em>${AJP.PORT}=0</em> no ajp connection where started.
69      </p>
70      <p><b>Note</b>: MX4J JSR 160 RMI Adaptor to support JDK 1.4 currently not integrated.
71      </p>
72      </li>
73      <li>Start your tomcat and look with a browser at http://${JMX.HOST}:${JMX.PORT}</li>
74      <li>With the mx connector parameter <code>mx.authMode="basic" mx.authUser="tomcat" mx.authPassword="strange"</code> 
75          you can control the access!</li>
76      <li>A complete list of all tomcat core MBeans can you find at <a href="funcspecs/mbean-names.html">
77        funcspecs/mbean-names.html</a>.</li>
78    </ol>
79    </p>
80
81  </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Manage Tomcat with JMX remote Ant Tasks"><strong>Manage Tomcat with JMX remote Ant Tasks</strong></a></font></td></tr><tr><td><blockquote>
82   <p>For simple tomcat ant task usage with ant 1.6.x we have integrate import and antlib support.</p>   
83   <p><b>antlib</b>Copy your catalina-ant.jar from $CATALINA_HOME/lib to $ANT_HOME/lib.</p>
84   <p>Following example show the JMX Accessor usage:</p>
85   <table border="1">
86   <tr><td><p><pre>
87&lt;project name="Catalina Ant JMX"
88        xmlns:jmx="antlib:org.apache.catalina.ant.jmx"
89        default="state"
90        basedir="."&gt;
91    &lt;property name="jmx.server.name" value="localhost" /&gt;
92    &lt;property name="jmx.server.port" value="9012" /&gt;
93    &lt;property name="cluster.server.address" value="192.168.1.75" /&gt;
94    &lt;property name="cluster.server.port" value="9025" /&gt;
95 
96    &lt;target name="state" description="Show JMX Cluster state"&gt;
97        &lt;jmx:open
98            host="${jmx.server.name}"
99            port="${jmx.server.port}"
100            username="controlRole"
101            password="tomcat"/&gt;
102        &lt;jmx:get
103            name="Catalina:type=IDataSender,host=localhost,senderAddress=${cluster.server.address},senderPort=${cluster.server.port}"
104            attribute="connected"
105            resultproperty="IDataSender.backup.connected"
106            echo="false"
107        /&gt;
108       &lt;jmx:get
109            name="Catalina:type=ClusterSender,host=localhost"
110            attribute="senderObjectNames"
111            resultproperty="senderObjectNames"
112            echo="false"
113        /&gt;
114        &lt;!-- get current maxActiveSession from ClusterTest application
115             echo it to ant output and store at
116             property &lt;em&gt;clustertest.maxActiveSessions.orginal&lt;/em&gt;
117        --&gt;
118       &lt;jmx:get
119            name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
120            attribute="maxActiveSessions"
121            resultproperty="clustertest.maxActiveSessions.orginal"
122            echo="true"
123        /&gt;
124        &lt;!-- set maxActiveSession to 100
125        --&gt;
126        &lt;jmx:set
127            name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
128            attribute="maxActiveSessions"
129            value="100"
130            type="int"
131        /&gt;
132        &lt;!-- get all sessions and split result as delimiter &lt;em&gt;SPACE&lt;/em&gt; for easy
133             access all session ids directly with ant property sessions.[0..n].
134        --&gt;
135        &lt;jmx:invoke
136            name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
137            operation="listSessionIds"
138            resultproperty="sessions"
139            echo="false"
140            delimiter=" "
141        /&gt;
142        &lt;!-- Access session attribute &lt;em&gt;Hello&lt;/em&gt; from first session.
143        --&gt;
144        &lt;jmx:invoke
145            name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
146            operation="getSessionAttribute"
147            resultproperty="Hello"
148            echo="false"
149        &gt;
150          &lt;arg value="${sessions.0}"/&gt;
151          &lt;arg value="Hello"/&gt;
152        &lt;/jmx:invoke&gt; 
153        &lt;!-- Query for all application manager.of the server from all hosts
154             and bind all attributes from all found manager mbeans.
155        --&gt;
156        &lt;jmx:query
157            name="Catalina:type=Manager,*"
158            resultproperty="manager"
159            echo="true"
160            attributebinding="true"
161        /&gt;
162        &lt;!-- echo the create properties --&gt;
163        &lt;echo&gt;
164           senderObjectNames: ${senderObjectNames.0}
165           IDataSender.backup.connected: ${IDataSender.backup.connected}
166           session: ${sessions.0}
167           manager.length: ${manager.length}
168           manager.0.name: ${manager.0.name}
169           manager.1.name: ${manager.1.name}
170           hello: ${Hello}
171           manager.ClusterTest.0.name: ${manager.ClusterTest.0.name}
172           manager.ClusterTest.0.activeSessions: ${manager.ClusterTest.0.activeSessions}
173           manager.ClusterTest.0.counterSend_EVT_SESSION_EXPIRED: ${manager.ClusterTest.0.counterSend_EVT_SESSION_EXPIRED}
174           manager.ClusterTest.0.counterSend_EVT_GET_ALL_SESSIONS: ${manager.ClusterTest.0.counterSend_EVT_GET_ALL_SESSIONS}
175        &lt;/echo&gt;   
176
177    &lt;/target&gt;
178 
179&lt;/project&gt;
180   </pre></p>
181   </td></tr>
182</table>
183   <p><b>import:</b> Import the JMX Accessor Projekt with
184   <em>&lt;import file="${CATALINA.HOME}/bin/jmxaccessor-tasks.xml" /&gt;</em> and
185   reference the tasks with <em>jmxOpen</em>, <em>jmxSet</em>, <em>jmxGet</em>,
186    <em>jmxQuery</em>, <em>jmxInvoke</em>,<em>jmxEquals</em> and <em>jmxCondition</em>. </p>
187
188  </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorOpenTask - jmx open connection task"><strong>JMXAccessorOpenTask - jmx open connection task</strong></a></font></td></tr><tr><td><blockquote>
189<p>
190List of Attributes<br>
191<table border="1" cellpadding="5">
192
193  <tr>
194    <th align="center" bgcolor="aqua">Attribute</th>
195    <th align="center" bgcolor="aqua">Description</th>
196    <th align="center" bgcolor="aqua">Default value</th>
197  </tr>
198
199  <tr>
200    <td>url</td>
201    <td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
202    </td>
203    <td></td>
204  </tr>
205
206  <tr>
207    <td>host</td>
208    <td>Set the host, shortcut the very long url syntax.
209    </td>
210    <td><code>localhost</code></td>
211  </tr>
212
213  <tr>
214    <td>port</td>
215    <td>Set the remote connection port
216    </td>
217    <td><code>8050</code></td>
218  </tr>
219
220  <tr>
221    <td>username</td>
222    <td>remote jmx connection user name.
223    </td>
224    <td></td>
225  </tr>
226
227  <tr>
228    <td>password</td>
229    <td>remote jmx connection password.
230    </td>
231    <td></td>
232  </tr>
233
234  <tr>
235    <td>ref</td>
236    <td>Name of the internal connection referenz. With this attribute you can
237        configure more the one connection inside the same ant projekt.
238    </td>
239    <td><code>jmx.server</code></td>
240  </tr>
241
242  <tr>
243    <td>echo</td>
244    <td>Echo the command usage (for analyse access or debugging)
245    </td>
246    <td><code>false</code></td>
247  </tr>
248 
249  <tr>
250    <td>if</td>
251    <td>Only execute if a property of the given name <b>exists</b> in the current project.
252    </td>
253    <td></td>
254  </tr>
255
256  <tr>
257    <td>unless</td>
258    <td>Only execute if a property of the given name <b>not exists</b> in the current project.
259    </td>
260    <td></td>
261  </tr>
262
263</table>
264</p>
265<p>
266Example to open a new jmx connection<br>
267<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>
268    &lt;jmx:open
269            host="${jmx.server.name}"
270            port="${jmx.server.port}"
271    /&gt;
272</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>
273</p> 
274<p>
275Example to open a jmx connection from url, with authorisation and
276store at other reference <br>
277<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>
278    &lt;jmx:open
279            url="service:jmx:rmi:///jndi/rmi://localhost:9024/jmxrmi"
280            ref="jmx.server.9024"
281            username="controlRole"
282            password="tomcat"   
283    /&gt;
284</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>
285</p> 
286
287<p>
288Example to open a jmx connection from url, with authorisation and
289store at other reference, but only when property <em>jmx.if</em> exists and
290<em>jmx.unless</em> not exists<br>
291<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>
292    &lt;jmx:open
293            url="service:jmx:rmi:///jndi/rmi://localhost:9024/jmxrmi"
294            ref="jmx.server.9024"
295            username="controlRole"
296            password="tomcat"   
297            if="jmx.if"   
298            unless="jmx.unless"   
299    /&gt;
300</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>
301</p> 
302<p><b>Note</b>: All properties from <em>jmxOpen</em> task also exists at all
303other tasks and conditions.
304</p>
305
306</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorGetTask:  get attribute value ant task"><strong>JMXAccessorGetTask:  get attribute value ant task</strong></a></font></td></tr><tr><td><blockquote>
307<p>
308List of Attributes<br>
309<table border="1" cellpadding="5">
310
311  <tr>
312    <th align="center" bgcolor="aqua">Attribute</th>
313    <th align="center" bgcolor="aqua">Description</th>
314    <th align="center" bgcolor="aqua">Default value</th>
315  </tr>
316
317  <tr>
318    <td>name</td>
319    <td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
320    </td>
321    <td></td>
322  </tr>
323
324  <tr>
325    <td>attribute</td>
326    <td>Existing Mbean attribute (see Tomcat mbean description above)
327    </td>
328    <td></td>
329  </tr>
330
331  <tr>
332    <td>ref</td>
333    <td>JMX Connection reference
334    </td>
335    <td><code>jmx.server</code></td>
336  </tr>
337
338  <tr>
339    <td>echo</td>
340    <td>Echo command usage (access and result)
341    </td>
342    <td><code>false</code></td>
343  </tr>
344
345  <tr>
346    <td>resultproperty</td>
347    <td>Save result at this project property
348    </td>
349    <td></td>
350  </tr>
351
352  <tr>
353    <td>delimiter</td>
354    <td>Split result with delimiter (java.util.StringTokenizier)
355        and use resultproperty as prefix to store tokens.
356    </td>
357    <td></td>
358  </tr>
359
360  <tr>
361    <td>separatearrayresults</td>
362    <td>When return value is an array, save result as property list
363    (<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
364    </td>
365    <td><code>true</code></td>
366  </tr>
367
368</table>
369</p>
370<p>
371Example to get remote mbean attribute from default jmx connection <br>
372<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>
373    &lt;jmx:get
374        name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
375        attribute="maxActiveSessions"
376        resultproperty="servlets-examples.maxActiveSessions"
377    /&gt;
378</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>
379</p> 
380<p>
381Example to get and result array and split it at separate properties<br>
382<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>
383    &lt;jmx:get
384        name="Catalina:type=ClusterSender,host=localhost"
385        attribute="senderObjectNames"
386        resultproperty="senderObjectNames"
387    /&gt;
388</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>
389Access the senderObjectNames properties with:
390<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>
391    ${senderObjectNames.lenght} give the number of returned sender list.
392    ${senderObjectNames.[0..N]} found all sender object names
393</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>
394</p> 
395
396<p>
397Example to get IDataSender attribute connected only when cluster is configured.
398<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>
399&lt;jmx:query
400    failonerror="false"
401    name="Catalina:type=Cluster,host=${tomcat.application.host}"
402    resultproperty="cluster"
403/&gt;
404&lt;jmx:get
405    name="Catalina:type=IDataSender,host=${tomcat.application.host},senderAddress=${cluster.backup.address},senderPort=${cluster.backup.port}"
406    attribute="connected"
407    resultproperty="datasender.connected"
408    if="cluster.0.name" /&gt;
409</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>
410</p> 
411
412</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorSetTask:  set attribute value ant task"><strong>JMXAccessorSetTask:  set attribute value ant task</strong></a></font></td></tr><tr><td><blockquote>
413<p>
414List of Attributes<br>
415<table border="1" cellpadding="5">
416
417  <tr>
418    <th align="center" bgcolor="aqua">Attribute</th>
419    <th align="center" bgcolor="aqua">Description</th>
420    <th align="center" bgcolor="aqua">Default value</th>
421  </tr>
422
423  <tr>
424    <td>name</td>
425    <td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
426    </td>
427    <td></td>
428  </tr>
429
430  <tr>
431    <td>attribute</td>
432    <td>Existing Mbean attribute (see Tomcat mbean description above)
433    </td>
434    <td></td>
435  </tr>
436
437  <tr>
438    <td>value</td>
439    <td>value that set to attribute
440    </td>
441    <td></td>
442  </tr>
443
444  <tr>
445    <td>type</td>
446    <td>type of the attribute.
447    </td>
448    <td>java.lang.String</td>
449  </tr>
450
451  <tr>
452    <td>ref</td>
453    <td>JMX Connection reference
454    </td>
455    <td><code>jmx.server</code></td>
456  </tr>
457
458  <tr>
459    <td>echo</td>
460    <td>Echo command usage (access and result)
461    </td>
462    <td><code>false</code></td>
463  </tr>
464
465</table>
466</p>
467<p>
468Example to set remote mbean attribute value<br>
469<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>
470    &lt;jmx:set
471        name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
472        attribute="maxActiveSessions"
473        value="500"
474        type="int"
475    /&gt;
476</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>
477</p> 
478
479</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorInvokeTask:  invoke Mbean operation ant task"><strong>JMXAccessorInvokeTask:  invoke Mbean operation ant task</strong></a></font></td></tr><tr><td><blockquote>
480<p>
481List of Attributes<br>
482<table border="1" cellpadding="5">
483
484  <tr>
485    <th align="center" bgcolor="aqua">Attribute</th>
486    <th align="center" bgcolor="aqua">Description</th>
487    <th align="center" bgcolor="aqua">Default value</th>
488  </tr>
489
490  <tr>
491    <td>name</td>
492    <td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
493    </td>
494    <td></td>
495  </tr>
496
497  <tr>
498    <td>operation</td>
499    <td>Existing Mbean operation (see Tomcat
500        <a href="funcspecs/fs-admin-opers.html">funcspecs/fs-admin-opers.html</a>.
501    </td>
502    <td></td>
503  </tr>
504
505  <tr>
506    <td>ref</td>
507    <td>JMX Connection reference
508    </td>
509    <td><code>jmx.server</code></td>
510  </tr>
511
512  <tr>
513    <td>echo</td>
514    <td>Echo command usage (access and result)
515    </td>
516    <td><code>false</code></td>
517  </tr>
518
519  <tr>
520    <td>resultproperty</td>
521    <td>Save result at this project property
522    </td>
523    <td></td>
524  </tr>
525
526  <tr>
527    <td>delimiter</td>
528    <td>Split result with delimiter (java.util.StringTokenizier)
529        and use resultproperty as prefix to store tokens.
530    </td>
531    <td></td>
532  </tr>
533
534  <tr>
535    <td>separatearrayresults</td>
536    <td>When return value is an array, save result as property list
537    (<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
538    </td>
539    <td><code>true</code></td>
540  </tr>
541
542</table>
543</p>
544<p>
545stop an application <br>
546<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>
547    &lt;jmx:invoke
548        name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
549        operation="stop"/&gt;
550</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>
551Now you can find the sessionid at <em>${sessions.[0..N}</em> properties and access the count
552with ${sessions.lenght} property.
553</p> 
554<p>
555Example to get all sessionids <br>
556<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>
557    &lt;jmx:invoke
558        name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
559        operation="listSessionIds"
560        resultproperty="sessions"
561        delimiter=" "       
562    /&gt;
563</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>
564Now you can find the sessionid at <em>${sessions.[0..N}</em> properties and access the count
565with ${sessions.lenght} property.
566</p> 
567<p>
568Example to get remote mbean session attribute from session ${sessionid.0}<br>
569<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>
570    &lt;jmx:invoke
571        name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
572        operation="getSessionAttribute"
573        resultproperty="hello"&gt;
574         &lt;arg value="${sessionid.0}"/&gt;
575         &lt;arg value="Hello" /&gt;
576 &lt;/jmx:invoke&gt;
577</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>
578</p>
579<p>
580Example to create a new access logger valve at vhost <em>localhost</em>
581<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
582 &lt;jmx:invoke
583         name="Catalina:type=MBeanFactory"
584         operation="createAcccesLoggerValve"
585         resultproperty="acccesLoggerObjectName"
586 &gt;
587     &lt;arg value="Catalina:type=Host,host=localhost"/&gt;
588 &lt;/jmx:invoke&gt;
589</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>
590Now you can find new Mbean with name stored at <em>${acccesLoggerObjectName}</em>
591proeprty.
592</p> 
593
594</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorQueryTask:  query Mbean ant task"><strong>JMXAccessorQueryTask:  query Mbean ant task</strong></a></font></td></tr><tr><td><blockquote>
595<p>
596List of Attributes<br>
597<table border="1" cellpadding="5">
598
599  <tr>
600    <th align="center" bgcolor="aqua">Attribute</th>
601    <th align="center" bgcolor="aqua">Description</th>
602    <th align="center" bgcolor="aqua">Default value</th>
603  </tr>
604
605  <tr>
606    <td>name</td>
607    <td>JMX  ObjectName query string -- <em>Catalina:type=Manager,*</em>
608    </td>
609    <td></td>
610  </tr>
611
612  <tr>
613    <td>ref</td>
614    <td>JMX Connection reference
615    </td>
616    <td><code>jmx.server</code></td>
617  </tr>
618
619  <tr>
620    <td>echo</td>
621    <td>Echo command usage (access and result)
622    </td>
623    <td><code>false</code></td>
624  </tr>
625
626  <tr>
627    <td>resultproperty</td>
628    <td>Prefix project property name to all founded Mbeans (<em>mbeans.[0..N].objectname</em>)
629    </td>
630    <td></td>
631  </tr>
632
633  <tr>
634    <td>attributebinduing</td>
635    <td>bind ALL MBean attributes in addition to <em>name</em>
636    </td>
637    <td><code>false</code></td>
638  </tr>
639
640  <tr>
641    <td>delimiter</td>
642    <td>Split result with delimiter (java.util.StringTokenizier)
643        and use resultproperty as prefix to store tokens.
644    </td>
645    <td></td>
646  </tr>
647
648  <tr>
649    <td>separatearrayresults</td>
650    <td>When return value is an array, save result as property list
651    (<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
652    </td>
653    <td><code>true</code></td>
654  </tr>
655
656</table>
657</p>
658<p>
659Get all Manager ObjectNames from all services and Hosts <br>
660<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>
661  &lt;jmx:query
662           name="Catalina:type=Manager,*
663           resultproperty="manager" /&gt;
664</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>
665Now you can find the Session Manager at <em>${manager.[0..N].name}</em> 
666properties and access the result object counter with ${manager.length} property.
667</p> 
668<p>
669Example to get the Manager from <em>servlet-examples</em> application an bind all mbean properties<br>
670<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>
671  &lt;jmx:query
672           name="Catalina:type=Manager,path=/servlet-examples,host=localhost*"
673           attributebinding="true"
674           resultproperty="manager.servletExamples" /&gt;
675</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>
676Now you can find the manager at <em>${manager.servletExamples.0.name}</em> property
677and can access all properties from this manager with <em>${manager.servletExamples.0.[manager attribute names]</em>}.
678The result object counter from MBeans is stored ad ${manager.length} property.
679</p> 
680
681<p>
682Example to get all MBeans from a server and store inside an external xml property file<br>
683<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>
684&lt;project name="jmx.query"         
685            xmlns:jmx="antlib:org.apache.catalina.ant.jmx"
686            default="query-all" basedir="."&gt;
687&lt;property name="jmx.host" value="localhost"/&gt;
688&lt;property name="jmx.port" value="8050"/&gt;
689&lt;property name="jmx.username" value="controlRole"/&gt;
690&lt;property name="jmx.password" value="tomcat"/&gt;
691
692&lt;target name="query-all" description="Query all MBeans of a server"&gt;
693&lt;!-- Configure connection --&gt;
694&lt;jmx:open
695    host="${jmx.host}"
696    port="${jmx.port}"
697    ref="jmx.server"
698    username="${jmx.username}"
699    password="${jmx.password}"/&gt;
700&lt;!-- Query MBean list --&gt;
701&lt;jmx:query
702    name="*:*"
703    resultproperty="mbeans"
704    attributebinding="false"/&gt;
705   
706&lt;echoproperties
707    destfile="mbeans.properties"
708    prefix="mbeans."
709    format="xml"/&gt;
710   
711&lt;!-- Print results --&gt;
712&lt;echo
713    message="Number of MBeans in server ${jmx.host}:${jmx.port} is ${mbeans.length}"/&gt;
714&lt;/target&gt;
715&lt;/project&gt;
716</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>
717Now you can find all MBeans inside the file <em>mbeans.properties</em>.
718</p> 
719
720</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorCreateTask:  remote create mbean ant task"><strong>JMXAccessorCreateTask:  remote create mbean ant task</strong></a></font></td></tr><tr><td><blockquote>
721<p>
722List of Attributes<br>
723<table border="1" cellpadding="5">
724
725  <tr>
726    <th align="center" bgcolor="aqua">Attribute</th>
727    <th align="center" bgcolor="aqua">Description</th>
728    <th align="center" bgcolor="aqua">Default value</th>
729  </tr>
730
731  <tr>
732    <td>name</td>
733    <td>Full qualified JMX ObjectName -- <em>Catalina:type=MBeanFactory</em>
734    </td>
735    <td></td>
736  </tr>
737
738  <tr>
739    <td>className</td>
740    <td>Existing MBean full qualified classname (see Tomcat mbean description above)
741    </td>
742    <td></td>
743  </tr>
744
745  <tr>
746    <td>classLoader</td>
747    <td>ObjectName of server or web application classloader <br>
748    ( <em>Catalina:type=ServerClassLoader,name=[server,common,shared]</em> or<br>
749     <em>Catalina:type=WebappClassLoader,path=/myapps,host=localhost</em>)
750    </td>
751    <td></td>
752  </tr>
753
754  <tr>
755    <td>ref</td>
756    <td>JMX Connection reference
757    </td>
758    <td><code>jmx.server</code></td>
759  </tr>
760
761  <tr>
762    <td>echo</td>
763    <td>Echo command usage (access and result)
764    </td>
765    <td><code>false</code></td>
766  </tr>
767
768</table>
769</p>
770<p>
771Example to create remote mbean<br>
772<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>
773    &lt;jmx:create
774             ref="${jmx.reference}"
775             name="Catalina:type=MBeanFactory"
776             className="org.apache.commons.modeler.BaseModelMBean"
777             classLoader="Catalina:type=ServerClassLoader,name=server"&gt;             
778             &lt;Arg value="org.apache.catalina.mbeans.MBeanFactory" /&gt;
779    &lt;/jmx:create&gt; 
780</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>
781</p> 
782<p>
783    <b>Warning</b>: A lot of tomcat mbeans can't be really create and connect with <br>
784    the parent. The valve, cluster or realm Mbeans are not autconnect with there parent.<br> 
785    Use <em>MBeanFacrory</em> create operation instead.
786</p>
787
788</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorUnregisterTask:  remote unregister mbean ant task"><strong>JMXAccessorUnregisterTask:  remote unregister mbean ant task</strong></a></font></td></tr><tr><td><blockquote>
789<p>
790List of Attributes<br>
791<table border="1" cellpadding="5">
792
793  <tr>
794    <th align="center" bgcolor="aqua">Attribute</th>
795    <th align="center" bgcolor="aqua">Description</th>
796    <th align="center" bgcolor="aqua">Default value</th>
797  </tr>
798
799  <tr>
800    <td>name</td>
801    <td>Full qualified JMX ObjectName -- <em>Catalina:type=MBeanFactory</em>
802    </td>
803    <td></td>
804  </tr>
805
806  <tr>
807    <td>ref</td>
808    <td>JMX Connection reference
809    </td>
810    <td><code>jmx.server</code></td>
811  </tr>
812
813  <tr>
814    <td>echo</td>
815    <td>Echo command usage (access and result)
816    </td>
817    <td><code>false</code></td>
818  </tr>
819
820</table>
821</p>
822<p>
823Example to unregister remote mbean<br>
824<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>
825    &lt;jmx:unregister
826        name="Catalina:type=MBeanFactory"
827    /&gt;
828</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>
829</p> 
830<p>
831    <b>Warning</b>: A lot of tomcat mbeans can't be really unregister. <br>
832    The Mbeans are not deregister from parent. Use <em>MBeanFacrory</em> <br>
833    remove operation instead.
834</p>
835
836</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorCondition:  express condition"><strong>JMXAccessorCondition:  express condition</strong></a></font></td></tr><tr><td><blockquote>
837<p>
838List of Attributes<br>
839<table border="1" cellpadding="5">
840
841  <tr>
842    <th align="center" bgcolor="aqua">Attribute</th>
843    <th align="center" bgcolor="aqua">Description</th>
844    <th align="center" bgcolor="aqua">Default value</th>
845  </tr>
846
847 <tr>
848    <td>url</td>
849    <td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
850    </td>
851    <td></td>
852  </tr>
853
854  <tr>
855    <td>host</td>
856    <td>Set the host, shortcut the very long url syntax.
857    </td>
858    <td><code>localhost</code></td>
859  </tr>
860
861  <tr>
862    <td>port</td>
863    <td>Set the remote connection port
864    </td>
865    <td><code>8050</code></td>
866  </tr>
867
868  <tr>
869    <td>username</td>
870    <td>remote jmx connection user name.
871    </td>
872    <td></td>
873  </tr>
874
875  <tr>
876    <td>password</td>
877    <td>remote jmx connection password.
878    </td>
879    <td></td>
880  </tr>
881
882  <tr>
883    <td>ref</td>
884    <td>Name of the internal connection reference. With this attribute you can
885        configure more the one connection inside the same ant projekt.
886    </td>
887    <td><code>jmx.server</code></td>
888  </tr>
889
890  <tr>
891    <td>name</td>
892    <td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
893    </td>
894    <td></td>
895  </tr>
896
897  <tr>
898    <td>echo</td>
899    <td>Echo condition usage (access and result)
900    </td>
901    <td><code>false</code></td>
902  </tr>
903
904  <tr>
905    <td>if</td>
906    <td>Only execute if a property of the given name <b>exists</b> in the current project.
907    </td>
908    <td></td>
909  </tr>
910
911  <tr>
912    <td>unless</td>
913    <td>Only execute if a property of the given name <b>not exists</b> in the current project.
914    </td>
915    <td></td>
916  </tr>
917
918  <tr>
919    <td>value (requiered)</td>
920    <td>Second arg for operation
921    </td>
922    <td></td>
923  </tr>
924
925  <tr>
926    <td>type</td>
927    <td>Value type to express operation (support <em>long</em> and <em>double</em>)
928    </td>
929    <td><code>long</code></td>
930  </tr>
931
932  <tr>
933    <td>operation</td>
934    <td> express one
935    <ul>
936    <li>==  equals</li>
937    <li>!=  not equals</li>
938    <li>&gt; greater than (&amp;gt;)</li>
939    <li>&gt;= greater than or equals (&amp;gt;=)</li>
940    <li>&lt; lesser than (&amp;lt;)</li>
941    <li>&lt;= lesser than or equals (&amp;lt;=)</li>
942    </ul>         
943    </td>
944    <td><code>==</code></td>
945  </tr>
946
947</table>
948</p>
949<p>
950Wait for server connection and that cluster backup node is accessable<br>
951<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>
952      &lt;target name="wait"&gt;
953         &lt;waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" &gt;
954            &lt;and&gt;
955                &lt;socket server="${server.name}" port="${server.port}"/&gt;
956                &lt;http url="${url}"/&gt;
957                &lt;jmx:condition
958                    operation="=="
959                    host="localhost"
960                    port="9014"
961                    username="controlRole"
962                    password="tomcat"
963                    name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
964                    attribute="connected"
965                    value="true"
966                /&gt;
967            &lt;/and&gt;
968        &lt;/waitfor&gt;
969        &lt;fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" /&gt;
970        &lt;echo message="Server ${url} alive" /&gt;
971    &lt;/target&gt;
972</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>
973</p> 
974
975</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="JMXAccessorEqualsCondition:  equals Mbean ant condition"><strong>JMXAccessorEqualsCondition:  equals Mbean ant condition</strong></a></font></td></tr><tr><td><blockquote>
976<p>
977List of Attributes<br>
978<table border="1" cellpadding="5">
979
980  <tr>
981    <th align="center" bgcolor="aqua">Attribute</th>
982    <th align="center" bgcolor="aqua">Description</th>
983    <th align="center" bgcolor="aqua">Default value</th>
984  </tr>
985
986 <tr>
987    <td>url</td>
988    <td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
989    </td>
990    <td></td>
991  </tr>
992
993  <tr>
994    <td>host</td>
995    <td>Set the host, shortcut the very long url syntax.
996    </td>
997    <td><code>localhost</code></td>
998  </tr>
999
1000  <tr>
1001    <td>port</td>
1002    <td>Set the remote connection port
1003    </td>
1004    <td><code>8050</code></td>
1005  </tr>
1006
1007  <tr>
1008    <td>username</td>
1009    <td>remote jmx connection user name.
1010    </td>
1011    <td></td>
1012  </tr>
1013
1014  <tr>
1015    <td>password</td>
1016    <td>remote jmx connection password.
1017    </td>
1018    <td></td>
1019  </tr>
1020
1021  <tr>
1022    <td>ref</td>
1023    <td>Name of the internal connection referenz. With this attribute you can
1024        configure more the one connection inside the same ant projekt.
1025    </td>
1026    <td><code>jmx.server</code></td>
1027  </tr>
1028
1029  <tr>
1030    <td>name</td>
1031    <td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
1032    </td>
1033    <td></td>
1034  </tr>
1035
1036
1037  <tr>
1038    <td>echo</td>
1039    <td>Echo condition usage (access and result)
1040    </td>
1041    <td><code>false</code></td>
1042  </tr>
1043
1044</table>
1045</p>
1046<p>
1047Wait for server connection and that cluster backup node is accessable<br>
1048<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>
1049      &lt;target name="wait"&gt;
1050         &lt;waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" &gt;
1051            &lt;and&gt;
1052                &lt;socket server="${server.name}" port="${server.port}"/&gt;
1053                &lt;http url="${url}"/&gt;
1054                &lt;jmx:equals
1055                    host="localhost"
1056                    port="9014"
1057                    username="controlRole"
1058                    password="tomcat"
1059                    name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
1060                    attribute="connected"
1061                    value="true"
1062                /&gt;
1063            &lt;/and&gt;
1064        &lt;/waitfor&gt;
1065        &lt;fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" /&gt;
1066        &lt;echo message="Server ${url} alive" /&gt;
1067    &lt;/target&gt;
1068</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>
1069</p> 
1070
1071</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>
1072        Copyright &copy; 1999-2008, Apache Software Foundation
1073        </em></font></div></td></tr></table></body></html>
Note: See TracBrowser for help on using the repository browser.