As of JBossAS 4.0.2, you can have JBoss MBeans visible in JConsole. In order to make this possible, you must do two things: first, you must enable the JConsole agent using the com.sun.management.jmxremote property. Secondly, you must tell JBossAS to use the platform MBeanServer as the server it installs its MBeans into. This modification to bin/run.conf demonstrates both settings:
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-server -Xms128m -Xmx512m"
fi
# Enable the jconsole agent locally
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
# Tell JBossAS to use the platform MBean server
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
With the following set, MBeans in the java.* JMX domains will show up in the JBoss jmx-console and web-console. The 4.0.2 release does not support incorporation of the JBoss MBeans into the jdk5 JConsole however. If you try, the server will fail to startup with an error like this:
Failed to boot JBoss:
javax.management.InstanceNotFoundException: JMImplementation:service=LoaderRepository,name=Default
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1010)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:804)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at org.jboss.system.server.ServerImpl.initBootLibraries(ServerImpl.java:602)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:395)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:328)
at org.jboss.Main.boot(Main.java:193)
at org.jboss.Main$1.run(Main.java:475)
at java.lang.Thread.run(Thread.java:595)
As of the JBossAS 4.0.3 release, you can configure the appserver such that the JBoss MBeans integrate into JConsole.
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-server -Xms128m -Xmx128m"
fi
# Enable the jconsole agent locally
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
# Tell JBossAS to use the platform MBean server
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
# Make the platform MBean server able to work with JBossAS MBeans
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
For Windows:
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
set JAVA_OPTS=%JAVA_OPTS% -Djboss.platform.mbeanserver
set JAVA_OPTS=%JAVA_OPTS% -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
Running JConsole against this configuration will bring up a console that incorporates both the JBoss and JVM MBeans.
Note: JBoss MBeans that use DOM elements as attributes may fail to display in JConsole. For example, the TreeCache and JChannel MBeans may fail with a "problem displaying MBean" message box. The console may provide no further information or it may indicate a null pointer exception. In either case, you probably need to add XercesImpl.jar to the jconsole classpath (e.g., by adding it to the endorsed directory of the JDK).
I'm having the same issue with win xe JBoss 4.2.2 and JBoss 4.2.3
All threads about JBoss AS and JConsole/VisualVM configuration mention about including
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
set JAVA_OPTS=%JAVA_OPTS% -Djboss.platform.mbeanserver
set JAVA_OPTS=%JAVA_OPTS% -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
and/or
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=9008
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
I also tired to connect remotely with JConsole to 4.2.3 on solaris 10
In both cases JConsole isn't able to connect and the stack trace is similar to the one written by dometec.
I was able to succesfully connect to 4.0.5 localy and remotely
I cannot connect to JBoss 4.2.3 using JConsole. I get a message "non-JRMP server at remote endpoint".
Hi, this work in 4.2.2 but don't in 5.0.0.GA
The Exception is:
javax.management.JMRuntimeException: Failed to load MBeanServerBuilder class org.jboss.system.server.jmx.MBeanServerBuilderImpl: java.lang.ClassNotFoundException: org.jboss.system.server.jmx.MBeanServerBuilderImpl
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:480)
at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:511)
at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:298)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:213)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:174)
at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302)
at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504)
at sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer(ConnectorBootstrap.java:412)
at sun.management.Agent.startAgent(Agent.java:135)
at sun.management.Agent.startAgent(Agent.java:239)
Caused by: java.lang.ClassNotFoundException: org.jboss.system.server.jmx.MBeanServerBuilderImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:423)
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:465)
... 9 more