JMXAccessorInvokeTask: invoke MBean operation Ant task

List of Attributes

Attribute Description Default value
name Full qualified JMX ObjectName — Catalina:type=Server
operation Existing MBean operation (see Tomcat funcspecs/fs-admin-opers.html).
ref JMX Connection reference jmx.server
echo Echo command usage (access and result) false
resultproperty Save result at this project property
delimiter Split result with delimiter (java.util.StringTokenizier) and use resultproperty as prefix to store tokens.
separatearrayresults When return value is an array, save result as property list ($resultproperty.[0..N] and $resultproperty.length) true

 

stop an application

<jmx:invoke

name=”Catalina:type=Manager,context=/servlets-examples,host=localhost”

operation=”stop”/>

 

Now you can find the sessionid at ${sessions.[0..N} properties and access the count with ${sessions.length} property.

 

Example to get all sessionids

<jmx:invoke

name=”Catalina:type=Manager,context=/servlets-examples,host=localhost”

operation=”listSessionIds”

resultproperty=”sessions”

delimiter=” ”

/>

Now you can find the sessionid at ${sessions.[0..N} properties and access the count with ${sessions.length} property.

 

Example to get remote MBean session attribute from session ${sessionid.0}

<jmx:invoke

name=”Catalina:type=Manager,context=/ClusterTest,host=localhost”

operation=”getSessionAttribute”

resultproperty=”hello”>

<arg value=”${sessionid.0}”/>

<arg value=”Hello” />

</jmx:invoke>

 

Example to create a new access logger valve at vhost localhost

<jmx:invoke

name=”Catalina:type=MBeanFactory”

operation=”createAccessLoggerValve”

resultproperty=”accessLoggerObjectName”

>

<arg value=”Catalina:type=Host,host=localhost”/>

</jmx:invoke>

Now you can find new MBean with name stored at ${accessLoggerObjectName} property.

JMXAccessorSetTask: set attribute value Ant task
Caching

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?