Version 14

    Using the JDK5 JConsole JMX Console

    The jconsole utility that ships with the Sun JDK5 provides a new level of VM information. The configuration of jconsole is discussed here:

    http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html

     

    Another good overview is here:

    http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

     

    To use jconsole, obviously you need to be using a release version of jdk5+. See the JBoss vs Java JDK Version Matrix page for which jboss versions work with jdk5.

     

    Using VisualVM over JMX

    VisualVM is included in most JDK6 distributions including OpenJDK in Fedora Gnu/Linux.  VisualVM uses the same JMX mechanism to connect to a running VM as JConsole and provides many more features.

     

    Connecting to a Local Server

    For AS releases prior to 6 M3, enable the JMX agent for local access, set the  system property in the run.conf/run.bat script. For example, in run.conf:

     

    #
    # 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"
    

     

    Next, launch jconsole, . This will bring up a java app with a connection dialog like:

     

    Connecting to a Remote Server

    jBoss must be run with the bindAddress configured to allow remote access. Typicaly, call run.sh -b 0.0.0.0.

     

    For AS releases prior to 6 M3, to enable monitoring and management from remote systems, set the  system property, where NNN is any free port number > 1024 in the run.conf/run.conf.bat script. For example, in run.conf:

     

    #
    # Specify options to pass to the Java VM.
    #
    if [ "x$JAVA_OPTS" = "x" ]; then
       JAVA_OPTS="-server -Xms128m -Xmx128m"
    fi
    
    # Enable the jconsole agent remotely on port 12345
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
    

     

    Note that this requires password security to be configured. To disable security and ssl transport, add two additional properties:

     

    # Enable the jconsole agent remotely on port 12345
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
    

     

    To connect the jconsole to use specify the hostname:NNN combo for the server. NNN is the same port number specified in the system property, for example . You can also start jconsole and then use the Connection/New Connection... menu item to bring up a connect dialog:

     

    Connecting to a Remote JBossAS 6.x+ Server

    Since AS 6.x uses java.util.logging to capture log output from all logging systems, you must also make sure that you add jboss-logmanager.jar to the boot classpath and configure the JDK to use it immediately.  You can do this via one more change to run.conf:

     

    JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
    JAVA_ARGS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
    JBOSS_CLASSPATH="lib/jboss-logmanager.jar"
    

     

    With this change, logging should work correctly.  WIthout this change, you'll get one or more message like this:

    Failed to initalize plugin: org.jboss.logging.logmanager.LoggerPluginImpl@359ecd80, cause: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
    

     

    With AS 6.0 M3+, you can use the JSR-160 JMXConnector support:

     

    jconsole service:jmx:rmi:///jndi/rmi://hostname:rmiRegistryPort/jmxrmi
           or
    jconsole service:jmx:rmi:///jndi/rmi://SERVERHOSTNAMEorIP:1090/jmxrmi