|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/share/tomcat5/webapps/tomcat-docs/ |
Upload File : |
<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>The Apache Tomcat 5.5 Servlet/JSP Container - 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="4" width="100%" border="0"><!--PAGE HEADER--><tr><td colspan="2"><!--JAKARTA LOGO--><a href="http://jakarta.apache.org/"><img border="0" alt="The Jakarta Project" align="left" src="./images/jakarta-logo.gif"></a><!--PROJECT LOGO--><a href="http://jakarta.apache.org/tomcat/"><img border="0" alt="
The Apache Tomcat Servlet/JSP Container
" align="right" src="./images/tomcat.gif"></a></td></tr><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade="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="../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</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">Apache Tomcat Configuration</a></li><li><a href="http://jakarta.apache.org/tomcat/connectors-doc/">JK 1.2 Documentation</a></li><li><a href="servletapi/index.html">Servlet API Javadocs</a></li><li><a href="jspapi/index.html">JSP API Javadocs</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="status.html">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="catalina/funcspecs/index.html">Functional Specs.</a></li><li><a href="catalina/docs/api/index.html">Apache Tomcat Javadocs</a></li><li><a href="jasper/docs/api/index.html">Apache Jasper Javadocs</a></li><li><a href="architecture/index.html">Architecture</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>The Apache Tomcat 5.5 Servlet/JSP Container</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
</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>
<p>Monitoring is a very important question today. Looking inside the running
server, grab some statistic data or reconfigure some aspects are
daliy adminstration tasks.</p>
</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>
<p>The Sun website includes the list of options and how to configure JMX Remote on Java 5:
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html">
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html</a>.
</p>
<p>For quick installation you find here a short installation guide:</p>
<p>Add the following parameters to your tomcat startup script:
<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>
set CATALINA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=%my.jmx.port% \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false"
</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>
</p>
<p>
<ol>
<li>When you think authorisation is a good, add and change this :
<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>
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access \
</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>
</li>
<li>edit the access allow file <em>$CATALINA_BASE/conf/jmxremote.access</em> :
<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>
monitorRole readonly
controlRole readwrite
</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>
</li>
<li>edit the password file <em>$CATALINA_BASE/conf/jmxremote.password</em> :
<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>
monitorRole tomcat
controlRole tomcat
</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>
<b>Tipp</b>: Password File must be readonly and not accessable from every
other user! Remove all other users under windows to access this file.
</li>
</ol>
<b>Note:</b>The JSR 160 JMX-Adaptor opens a second data protocol port. That is a problem
when you have installed a local firewall.<br>
</p>
<p>Activate JMX MX4J Http Adaptor with Java 1.4:
<ol>
<li>Install the tomcat compat package</li>
<li>Install the mx4j-tools.jar at common/lib. Please, use the same MX4j
version as your tomcat release</li>
<li>Configure a MX4J JMX HTTP Adaptor at your AJP Connector
<p>
<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>
<Connector port="${AJP.PORT}"
handler.list="mx"
mx.enabled="true"
mx.httpHost="${JMX.HOST}"
mx.httpPort="${JMX.PORT}"
protocol="AJP/1.3" />
</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>
</p>
<p><b>Tipp</b>: With <em>${AJP.PORT}=0</em> no ajp connection where started.
</p>
<p><b>Note</b>: MX4J JSR 160 RMI Adaptor to support JDK 1.4 currently not integrated.
</p>
</li>
<li>Start your tomcat and look with a browser at http://${JMX.HOST}:${JMX.PORT}</li>
<li>With the mx connector parameter <code>mx.authMode="basic" mx.authUser="tomcat" mx.authPassword="strange"</code>
you can control the access!</li>
<li>A complete list of all tomcat core MBeans can you find at <a href="http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/funcspecs/mbean-names.html">
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/funcspecs/mbean-names.html</a>.</li>
</ol>
</p>
</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>
<p>For simple tomcat ant task usage with ant 1.6.x we have integrate import and antlib support.</p>
<p><b>antlib</b>Copy your catalina-ant.jar from $CATALINA_HOME/server/lib to $ANT_HOME/lib.</p>
<p>Following example show the JMX Accessor usage:</p>
<table border="1">
<tr><td><p><pre>
<project name="Catalina Ant JMX"
xmlns:jmx="antlib:org.apache.catalina.ant.jmx"
default="state"
basedir=".">
<property name="jmx.server.name" value="localhost" />
<property name="jmx.server.port" value="9012" />
<property name="cluster.server.address" value="192.168.1.75" />
<property name="cluster.server.port" value="9025" />
<target name="state" description="Show JMX Cluster state">
<jmx:open
host="${jmx.server.name}"
port="${jmx.server.port}"
username="controlRole"
password="tomcat"/>
<jmx:get
name="Catalina:type=IDataSender,host=localhost,senderAddress=${cluster.server.address},senderPort=${cluster.server.port}"
attribute="connected"
resultproperty="IDataSender.backup.connected"
echo="false"
/>
<jmx:get
name="Catalina:type=ClusterSender,host=localhost"
attribute="senderObjectNames"
resultproperty="senderObjectNames"
echo="false"
/>
<!-- get current maxActiveSession from ClusterTest application
echo it to ant output and store at
property <em>clustertest.maxActiveSessions.orginal</em>
-->
<jmx:get
name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
attribute="maxActiveSessions"
resultproperty="clustertest.maxActiveSessions.orginal"
echo="true"
/>
<!-- set maxActiveSession to 100
-->
<jmx:set
name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
attribute="maxActiveSessions"
value="100"
type="int"
/>
<!-- get all sessions and split result as delimiter <em>SPACE</em> for easy
access all session ids directly with ant property sessions.[0..n].
-->
<jmx:invoke
name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
operation="listSessionIds"
resultproperty="sessions"
echo="false"
delimiter=" "
/>
<!-- Access session attribute <em>Hello</em> from first session.
-->
<jmx:invoke
name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
operation="getSessionAttribute"
resultproperty="Hello"
echo="false"
>
<arg value="${sessions.0}"/>
<arg value="Hello"/>
</jmx:invoke>
<!-- Query for all application manager.of the server from all hosts
and bind all attributes from all found manager mbeans.
-->
<jmx:query
name="Catalina:type=Manager,*"
resultproperty="manager"
echo="true"
attributebinding="true"
/>
<!-- echo the create properties -->
<echo>
senderObjectNames: ${senderObjectNames.0}
IDataSender.backup.connected: ${IDataSender.backup.connected}
session: ${sessions.0}
manager.length: ${manager.length}
manager.0.name: ${manager.0.name}
manager.1.name: ${manager.1.name}
hello: ${Hello}
manager.ClusterTest.0.name: ${manager.ClusterTest.0.name}
manager.ClusterTest.0.activeSessions: ${manager.ClusterTest.0.activeSessions}
manager.ClusterTest.0.counterSend_EVT_SESSION_EXPIRED: ${manager.ClusterTest.0.counterSend_EVT_SESSION_EXPIRED}
manager.ClusterTest.0.counterSend_EVT_GET_ALL_SESSIONS: ${manager.ClusterTest.0.counterSend_EVT_GET_ALL_SESSIONS}
</echo>
</target>
</project>
</pre></p>
</td></tr>
</table>
<p><b>import:</b> Import the JMX Accessor Projekt with
<em><import file="${CATALINA.HOME}/bin/jmxaccessor-tasks.xml" /></em> and
reference the tasks with <em>jmxOpen</em>, <em>jmxSet</em>, <em>jmxGet</em>,
<em>jmxQuery</em>, <em>jmxInvoke</em>,<em>jmxEquals</em> and <em>jmxCondition</em>. </p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>url</td>
<td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
</td>
<td></td>
</tr>
<tr>
<td>host</td>
<td>Set the host, shortcut the very long url syntax.
</td>
<td><code>localhost</code></td>
</tr>
<tr>
<td>port</td>
<td>Set the remote connection port
</td>
<td><code>8050</code></td>
</tr>
<tr>
<td>username</td>
<td>remote jmx connection user name.
</td>
<td></td>
</tr>
<tr>
<td>password</td>
<td>remote jmx connection password.
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>Name of the internal connection referenz. With this attribute you can
configure more the one connection inside the same ant projekt.
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo the command usage (for analyse access or debugging)
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>if</td>
<td>Only execute if a property of the given name <b>exists</b> in the current project.
</td>
<td></td>
</tr>
<tr>
<td>unless</td>
<td>Only execute if a property of the given name <b>not exists</b> in the current project.
</td>
<td></td>
</tr>
</table>
</p>
<p>
Example to open a new jmx connection<br>
<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>
<jmx:open
host="${jmx.server.name}"
port="${jmx.server.port}"
/>
</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>
</p>
<p>
Example to open a jmx connection from url, with authorisation and
store at other reference <br>
<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>
<jmx:open
url="service:jmx:rmi:///jndi/rmi://localhost:9024/jmxrmi"
ref="jmx.server.9024"
username="controlRole"
password="tomcat"
/>
</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>
</p>
<p>
Example to open a jmx connection from url, with authorisation and
store at other reference, but only when property <em>jmx.if</em> exists and
<em>jmx.unless</em> not exists<br>
<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>
<jmx:open
url="service:jmx:rmi:///jndi/rmi://localhost:9024/jmxrmi"
ref="jmx.server.9024"
username="controlRole"
password="tomcat"
if="jmx.if"
unless="jmx.unless"
/>
</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>
</p>
<p><b>Note</b>: All properties from <em>jmxOpen</em> task also exists at all
other tasks and conditions.
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
</td>
<td></td>
</tr>
<tr>
<td>attribute</td>
<td>Existing Mbean attribute (see Tomcat mbean description above)
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>resultproperty</td>
<td>Save result at this project property
</td>
<td></td>
</tr>
<tr>
<td>delimiter</td>
<td>Split result with delimiter (java.util.StringTokenizier)
and use resultproperty as prefix to store tokens.
</td>
<td></td>
</tr>
<tr>
<td>separatearrayresults</td>
<td>When return value is an array, save result as property list
(<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
</td>
<td><code>true</code></td>
</tr>
</table>
</p>
<p>
Example to get remote mbean attribute from default jmx connection <br>
<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>
<jmx:get
name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
attribute="maxActiveSessions"
resultproperty="servlets-examples.maxActiveSessions"
/>
</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>
</p>
<p>
Example to get and result array and split it at separate properties<br>
<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>
<jmx:get
name="Catalina:type=ClusterSender,host=localhost"
attribute="senderObjectNames"
resultproperty="senderObjectNames"
/>
</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>
Access the senderObjectNames properties with:
<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>
${senderObjectNames.lenght} give the number of returned sender list.
${senderObjectNames.[0..N]} found all sender object names
</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>
</p>
<p>
Example to get IDataSender attribute connected only when cluster is configured.
<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>
<jmx:query
failonerror="false"
name="Catalina:type=Cluster,host=${tomcat.application.host}"
resultproperty="cluster"
/>
<jmx:get
name="Catalina:type=IDataSender,host=${tomcat.application.host},senderAddress=${cluster.backup.address},senderPort=${cluster.backup.port}"
attribute="connected"
resultproperty="datasender.connected"
if="cluster.0.name" />
</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>
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
</td>
<td></td>
</tr>
<tr>
<td>attribute</td>
<td>Existing Mbean attribute (see Tomcat mbean description above)
</td>
<td></td>
</tr>
<tr>
<td>value</td>
<td>value that set to attribute
</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>type of the attribute.
</td>
<td>java.lang.String</td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
</table>
</p>
<p>
Example to set remote mbean attribute value<br>
<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>
<jmx:set
name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
attribute="maxActiveSessions"
value="500"
type="int"
/>
</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>
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
</td>
<td></td>
</tr>
<tr>
<td>operation</td>
<td>Existing Mbean operation (see Tomcat
<a href="http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/funcspecs/fs-admin-opers.html">
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/funcspecs/fs-admin-opers.html</a>.
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>resultproperty</td>
<td>Save result at this project property
</td>
<td></td>
</tr>
<tr>
<td>delimiter</td>
<td>Split result with delimiter (java.util.StringTokenizier)
and use resultproperty as prefix to store tokens.
</td>
<td></td>
</tr>
<tr>
<td>separatearrayresults</td>
<td>When return value is an array, save result as property list
(<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
</td>
<td><code>true</code></td>
</tr>
</table>
</p>
<p>
stop an application <br>
<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>
<jmx:invoke
name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
operation="stop"/>
</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>
Now you can find the sessionid at <em>${sessions.[0..N}</em> properties and access the count
with ${sessions.lenght} property.
</p>
<p>
Example to get all sessionids <br>
<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>
<jmx:invoke
name="Catalina:type=Manager,path=/servlets-examples,host=localhost"
operation="listSessionIds"
resultproperty="sessions"
delimiter=" "
/>
</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>
Now you can find the sessionid at <em>${sessions.[0..N}</em> properties and access the count
with ${sessions.lenght} property.
</p>
<p>
Example to get remote mbean session attribute from session ${sessionid.0}<br>
<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>
<jmx:invoke
name="Catalina:type=Manager,path=/ClusterTest,host=localhost"
operation="getSessionAttribute"
resultproperty="hello">
<arg value="${sessionid.0}"/>
<arg value="Hello" />
</jmx:invoke>
</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>
</p>
<p>
Example to create a new access logger valve at vhost <em>localhost</em>
<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>
<jmx:invoke
name="Catalina:type=MBeanFactory"
operation="createAcccesLoggerValve"
resultproperty="acccesLoggerObjectName"
>
<arg value="Catalina:type=Host,host=localhost"/>
</jmx:invoke>
</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>
Now you can find new Mbean with name stored at <em>${acccesLoggerObjectName}</em>
proeprty.
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>JMX ObjectName query string -- <em>Catalina:type=Manager,*</em>
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>resultproperty</td>
<td>Prefix project property name to all founded Mbeans (<em>mbeans.[0..N].objectname</em>)
</td>
<td></td>
</tr>
<tr>
<td>attributebinduing</td>
<td>bind ALL MBean attributes in addition to <em>name</em>
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>delimiter</td>
<td>Split result with delimiter (java.util.StringTokenizier)
and use resultproperty as prefix to store tokens.
</td>
<td></td>
</tr>
<tr>
<td>separatearrayresults</td>
<td>When return value is an array, save result as property list
(<em>$resultproperty.[0..N]</em> and <em>$resultproperty.lenght</em>)
</td>
<td><code>true</code></td>
</tr>
</table>
</p>
<p>
Get all Manager ObjectNames from all services and Hosts <br>
<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>
<jmx:query
name="Catalina:type=Manager,*
resultproperty="manager" />
</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>
Now you can find the Session Manager at <em>${manager.[0..N].name}</em>
properties and access the result object counter with ${manager.length} property.
</p>
<p>
Example to get the Manager from <em>servlet-examples</em> application an bind all mbean properties<br>
<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>
<jmx:query
name="Catalina:type=Manager,path=/servlet-examples,host=localhost*"
attributebinding="true"
resultproperty="manager.servletExamples" />
</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>
Now you can find the manager at <em>${manager.servletExamples.0.name}</em> property
and can access all properties from this manager with <em>${manager.servletExamples.0.[manager attribute names]</em>}.
The result object counter from MBeans is stored ad ${manager.length} property.
</p>
<p>
Example to get all MBeans from a server and store inside an external xml property file<br>
<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>
<project name="jmx.query"
xmlns:jmx="antlib:org.apache.catalina.ant.jmx"
default="query-all" basedir=".">
<property name="jmx.host" value="localhost"/>
<property name="jmx.port" value="8050"/>
<property name="jmx.username" value="controlRole"/>
<property name="jmx.password" value="tomcat"/>
<target name="query-all" description="Query all MBeans of a server">
<!-- Configure connection -->
<jmx:open
host="${jmx.host}"
port="${jmx.port}"
ref="jmx.server"
username="${jmx.username}"
password="${jmx.password}"/>
<!-- Query MBean list -->
<jmx:query
name="*:*"
resultproperty="mbeans"
attributebinding="false"/>
<echoproperties
destfile="mbeans.properties"
prefix="mbeans."
format="xml"/>
<!-- Print results -->
<echo
message="Number of MBeans in server ${jmx.host}:${jmx.port} is ${mbeans.length}"/>
</target>
</project>
</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>
Now you can find all MBeans inside the file <em>mbeans.properties</em>.
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=MBeanFactory</em>
</td>
<td></td>
</tr>
<tr>
<td>className</td>
<td>Existing MBean full qualified classname (see Tomcat mbean description above)
</td>
<td></td>
</tr>
<tr>
<td>classLoader</td>
<td>ObjectName of server or web application classloader <br>
( <em>Catalina:type=ServerClassLoader,name=[server,common,shared]</em> or<br>
<em>Catalina:type=WebappClassLoader,path=/myapps,host=localhost</em>)
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
</table>
</p>
<p>
Example to create remote mbean<br>
<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>
<jmx:create
ref="${jmx.reference}"
name="Catalina:type=MBeanFactory"
className="org.apache.commons.modeler.BaseModelMBean"
classLoader="Catalina:type=ServerClassLoader,name=server">
<Arg value="org.apache.catalina.mbeans.MBeanFactory" />
</jmx:create>
</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>
</p>
<p>
<b>Warning</b>: A lot of tomcat mbeans can't be really create and connect with <br>
the parent. The valve, cluster or realm Mbeans are not autconnect with there parent.<br>
Use <em>MBeanFacrory</em> create operation instead.
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=MBeanFactory</em>
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>JMX Connection reference
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>echo</td>
<td>Echo command usage (access and result)
</td>
<td><code>false</code></td>
</tr>
</table>
</p>
<p>
Example to unregister remote mbean<br>
<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>
<jmx:unregister
name="Catalina:type=MBeanFactory"
/>
</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>
</p>
<p>
<b>Warning</b>: A lot of tomcat mbeans can't be really unregister. <br>
The Mbeans are not deregister from parent. Use <em>MBeanFacrory</em> <br>
remove operation instead.
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>url</td>
<td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
</td>
<td></td>
</tr>
<tr>
<td>host</td>
<td>Set the host, shortcut the very long url syntax.
</td>
<td><code>localhost</code></td>
</tr>
<tr>
<td>port</td>
<td>Set the remote connection port
</td>
<td><code>8050</code></td>
</tr>
<tr>
<td>username</td>
<td>remote jmx connection user name.
</td>
<td></td>
</tr>
<tr>
<td>password</td>
<td>remote jmx connection password.
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>Name of the internal connection reference. With this attribute you can
configure more the one connection inside the same ant projekt.
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>Echo condition usage (access and result)
</td>
<td><code>false</code></td>
</tr>
<tr>
<td>if</td>
<td>Only execute if a property of the given name <b>exists</b> in the current project.
</td>
<td></td>
</tr>
<tr>
<td>unless</td>
<td>Only execute if a property of the given name <b>not exists</b> in the current project.
</td>
<td></td>
</tr>
<tr>
<td>value (requiered)</td>
<td>Second arg for operation
</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>Value type to express operation (support <em>long</em> and <em>double</em>)
</td>
<td><code>long</code></td>
</tr>
<tr>
<td>operation</td>
<td> express one
<ul>
<li>== equals</li>
<li>!= not equals</li>
<li>> greater than (&gt;)</li>
<li>>= greater than or equals (&gt;=)</li>
<li>< lesser than (&lt;)</li>
<li><= lesser than or equals (&lt;=)</li>
</ul>
</td>
<td><code>==</code></td>
</tr>
</table>
</p>
<p>
Wait for server connection and that cluster backup node is accessable<br>
<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>
<target name="wait">
<waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" >
<and>
<socket server="${server.name}" port="${server.port}"/>
<http url="${url}"/>
<jmx:condition
operation="=="
host="localhost"
port="9014"
username="controlRole"
password="tomcat"
name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
attribute="connected"
value="true"
/>
</and>
</waitfor>
<fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
<echo message="Server ${url} alive" />
</target>
</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>
</p>
</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>
<p>
List of Attributes<br>
<table border="1" cellpadding="5">
<tr>
<th align="center" bgcolor="aqua">Attribute</th>
<th align="center" bgcolor="aqua">Description</th>
<th align="center" bgcolor="aqua">Default value</th>
</tr>
<tr>
<td>url</td>
<td>Set jmx connection url - <em>service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi</em>
</td>
<td></td>
</tr>
<tr>
<td>host</td>
<td>Set the host, shortcut the very long url syntax.
</td>
<td><code>localhost</code></td>
</tr>
<tr>
<td>port</td>
<td>Set the remote connection port
</td>
<td><code>8050</code></td>
</tr>
<tr>
<td>username</td>
<td>remote jmx connection user name.
</td>
<td></td>
</tr>
<tr>
<td>password</td>
<td>remote jmx connection password.
</td>
<td></td>
</tr>
<tr>
<td>ref</td>
<td>Name of the internal connection referenz. With this attribute you can
configure more the one connection inside the same ant projekt.
</td>
<td><code>jmx.server</code></td>
</tr>
<tr>
<td>name</td>
<td>Full qualified JMX ObjectName -- <em>Catalina:type=Server</em>
</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>Echo condition usage (access and result)
</td>
<td><code>false</code></td>
</tr>
</table>
</p>
<p>
Wait for server connection and that cluster backup node is accessable<br>
<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>
<target name="wait">
<waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" >
<and>
<socket server="${server.name}" port="${server.port}"/>
<http url="${url}"/>
<jmx:equals
host="localhost"
port="9014"
username="controlRole"
password="tomcat"
name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
attribute="connected"
value="true"
/>
</and>
</waitfor>
<fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
<echo message="Server ${url} alive" />
</target>
</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>
</p>
</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade="noshade"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em>
Copyright © 1999-2005, Apache Software Foundation
</em></font></div></td></tr></table></body></html>