Version 4

    Enabling management agent in JVM

    To attach jconsole to a JVM, it has to be launched with a management agent:

    java -jar ... -Dcom.sun.management.jmxremote
    

     

    To run JBoss AS with the agent enabled, simply run:

    <jboss-home>/bin/run.sh -Dcom.sun.management.jmxremote

     

    See JBossRunParameters.

    See also: http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#jmxagent

     

    Connecting jconsole to a JVM

    To list java processes, run jps (found in <java_home/bin>).

    $ jps -l
    28922 org.jboss.Main
    28946 sun.tools.jps.Jps
    28871 org.codehaus.classworlds.Launcher
    18290 org.netbeans.Main

    Then connect the jconsole:

    $ jconsole 28922
    

    Happy monitoring

     

    Connecting jconsole to JBoss AS started from Cargo plugin for Maven

     

    To pass the parameter using Cargo plugin for Maven, add this to pom.xml:

     

    <build>
        <plugins>
           <plugin>
              ...
              <configuration>
                 <!-- Container configuration -->
                 <configuration>
                   <properties>
                     <com.sun.management.jmxremote></com.sun.management.jmxremote>
                   </properties>
                 </configuration>
                 <!-- /Container configuration -->
              </configuration>
              ...
           </plugin>
        </plugins>
     </build>