A task to allow the operations of a JMX MBean to be invoked.

Note: This task depends on external libraries that are not included in the Ant distribution.


Attribute Description Required
operation The name of the operation to invoke. Yes
resultProperty The name of the Ant property used to store the result of the operation. The default value is the operation name plus ".result". For example, invoking operation foo would store any result in the property ${foo.result}. No
mbeanref A reference to a mbean type.

If a reference to an mbean is specified, then the name, serverType, providerUrl, jndiName, user, and password attributes of this task are not used.
name The object name of the JMX MBean. This name follows the standard JMX ObjectName form of:
Here are some examples for weblogic:

Here are some examples for jboss:


Unless mbeanref is set
serverType The type of server involved. Valid values are weblogic, jboss, or jboss.ejb. The setting of this value determines the default value for the jndiName and providerUrl attributes.

NOTE:If this value is other than weblogic, jboss, or jboss.ejb then it is assumed to be a fully qualified class name that implements This is used to support additional types of servers without modifying the Ant JMX task classes.

Unless mbeanref is set
providerUrl The JNDI providerUrl for the JMX MBean server. If serverType is set to weblogic, the default value is t3://localhost:7001. If serverType is set to jboss, the default value is jnp://localhost:1099. No
jndiName The JNDI name for the JMX MBeanServer. If serverType is set to weblogic, the default value is If serverType is set to jboss, the default value is jmx:<hostname>:rmi. No
user The user name used for authentication with the JMX server. No
password The password used for authentication with the JMX server. No
failOnError If an error is detected (e.g. can't contact server, bad login, etc.), should this cause the task to fail? The default value is false, meaning a warning message will be logged but the build will continue. No

Parameters specified as nested elements


Specifies the parameters to pass to the operation being invoked. Parameters must be listed in the order defined by the operation being invoked. It take the following attributes:

Attribute Description Required
value The value of the attribute. Yes
type The type of the attribute. If ommitted, the parameters must be specified in the exact order they are declared on the interface for the mbean operation. No


Invokes the getAttributeStringValue operation on the a JDBCConnectionPool MBean called myPool. This MBean is in the domain mydomain accessible at the providerUrl t3://localhost:7001.
<invokeMBean operation="getAttributeStringValue" name="mydomain:Name=myPool,Type=JDBCConnectionPool"
serverType="weblogic" providerUrl="t3://localhost:7001" user="system" password="secret">
   <parameter value="${attName}"/>

$Id: InvokeMBeanTask.html,v 1.3 2003/05/27 12:06:46 bdueck Exp $

Copyright © 2002 Apache Software Foundation. All rights Reserved.