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: Connection Listing all MBeans Listing all MBean attributes, types, and mutability Listing all MBean operations, parameters, and return types Getting an attributes current value Setting an attributes value Invoking 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.InvalidAttri