Enabling JMX in JBoss AS 6 and JDK 6

I'm trying to create a demo of VisualVM (a really neat BCI tool that now ships with Oracle's JDK 6) connecting to Red Hat's JBoss Application Server 6. The wrinkle is that there is some interaction with JBoss' LogManager when JMX is turned on. This results in a torrent of class not found exceptions when starting up the Application Server.

To quell these errors, the following lines have to be added to the run.conf:


# stuff for JMX
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=6789"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=your.jboss.ip.address"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"

# there's an interaction between JDK 6 and JBoss LogManager when JMX is turned on..
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
JBOSS_CLASSPATH="$JBOSS_CLASSPATH:/home/orly/sw/jboss-6.0.0.Final/lib/jboss-logmanager.jar"


Note that the above example turns off all authentication for JMX connections.. not something you'd want to do on a server that's on a public IP. But I am lazy.. in any case, if you're using Linux, you can use IPTables to restrict which IP's can connect to your JMX port.