Posts

Showing posts from January, 2012

Remote JMX client

Java 6 JMX
Code Example
Add these properties to the target VM to specify the jmx port and allow remote connections so you can get to it from other systems without the need for authentication.
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9999" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

The example below demonstrates the following: ConnectionListing all MBeansListing all MBean attributes, types, and mutabilityListing all MBean operations, parameters, and return typesGetting an attributes current valueSetting an attributes valueInvoking operations
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;

import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import j…