A task to allow the attributes of a JMX MBean to be retrieved and changed.
Note: This task depends on external libraries that are not included in the Ant distribution.
| Attribute | Description | Required |
| 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. | No |
| 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:
|
YesUnless 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 org.apache.tools.ant.taskdefs.optional.jmx.connector.JMXConnector.
This is used to support additional types of servers without modifying
the Ant JMX task classes.
|
YesUnless 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 weblogic.management.adminhome.
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 |
Changes the value of an MBean attribute. It take the following attributes:
| Attribute | Description | Required |
| name | The name of the attribute. | Yes |
| value | The new value for the attribute. | Yes |
Retrieves the value of an MBean attribute. It take the following attributes:
| Attribute | Description | Required |
| name | The name of the attribute. | Yes |
| property | The name of the Ant property that will receive the property value. The default value is the attribute name - meaning that an Ant property with the same name as the attribute name will be created. | No |
JDBCConnectionPool MBean called myPool. This MBean is
in the domain mydomain hosted on a BEA weblogic server running on
the same host as the Ant script.
<configureMBean name="mydomain:Name=myPool,Type=JDBCConnectionPool" failOnError="false"
serverType="weblogic" user="system" password="secret">
  <setAttribute name="Targets">:Name=myserver,Type=Server</setAttribute>
  <setAttribute name="MaxCapacity" value="${pool.size}"/>
  <getAttribute name="TestTableName" property="testTable"/>
</configureMBean>
Here are some additonal getAttribute and setAttribute examples (parent configureMBean element ommitted for
brevity):
Sets the MaxCapacity attribute to the value of the "pool.size" Ant variable.
...
<setAttribute name="MaxCapacity" value="${pool.size}"/>
...
Retrieves the value of
the TestTableName attribute and stores it int the Ant property ${table}.
Same as obove, but optional property value is ommitted, so the attribute name (TestTableName) is used as the default attribute name.... <getAttribute name="TestTableName" property="table"/> ...
...
<getAttribute name="TestTableName"/>
...
<echo message="${TestTableName}"/>
...
$Id: ConfigureMBeanTask.html,v 1.3 2003/05/28 22:26:30 bdueck Exp $
Copyright © 2002 Apache Software Foundation. All rights Reserved.