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

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

NutchEz - an easy way to nutch

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