Version 12

    Displaying the JBoss MBeans in JConsole

    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).