How to connect Java Mission Control with EAP remotely?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x
  • Oracle JDK
    • 7 Update 40 (7u40) onwards
  • OpenJDK
    • 11 onwards

Issue

  • How to connect Java Mission Control (jmc) with a EAP 6 server instance?
  • Managed to connect the server instance with jconsole using the jconsole.bat and configuring jmx subsystem. Is there any script to launch jmc?
  • How do we integrate Java Mission Control (jmc) and EAP 6?

Resolution

  • To connect to individual server instances in domain mode, first see Connecting To JBoss Via JConsole in Domain Mode for the pre-requisite configuration changes needed to connect to the individual instances on port 4447 instead of the host controller on port 9999.

  • To connect this jmc with a EAP server instance you can follow the steps below:

  1. Edit the "jdk1.7.0_51/bin/jmc.ini" file which contains the JVM and JAVA_OPTS related information in this file somewhere at the end users can add the "-Xbootclasspath/a" option to include the "$JBOSS_HOME/bin/client/jboss-client.jar" as following:

    -startup
    ../lib/missioncontrol/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    --launcher.library
    ../lib/missioncontrol/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
    -vm
    ./java
    -vmargs
    -XX:+UseG1GC
    -XX:+UnlockCommercialFeatures
    -XX:+FlightRecorder
    -Djava.net.preferIPv4Stack=true
    -Xbootclasspath/a:/jboss-eap-6.2.0/bin/client/jboss-client.jar   <--------NOTICE HERE------>
    

    If Management Interface has https configured, then add the following to the jmc.ini too:

    -Djavax.net.ssl.trustStore=/path/to/truststore.jks 
    -Djavax.net.ssl.trustStorePassword=secret
    
  2. Once the "jmc.ini" file is edited as above then Java Mission Control (jmc) can be started as following:

    $JAVA_HOME/bin/jmc
    
  3. Once the Java Mission Control GUI is opened then you will get a Welcome window like this:

    jmc-welcome-screen.png

  4. Then you have to close this welcome window and then click on "Create New Custom JVM Connection" icon which is highlighted by the red line in the following screenshot on the "JVM Browser" tab:

    initialwindow1.png

  5. Then in the following "JVM Connection" wizard click on "Custom JMX Service URL" button:

    jvmconnection1.png

  6. Then Enter the "JMX Service URL" in the below pattern in the following JVM Connection Window:

     service:jmx:remoting-jmx://$HOST:$PORT
    Example:
     service:jmx:remoting-jmx://10.10.10.10:9999
    

    For EAP 7

    service:jmx:remote+http://jbosshost:9990
    or
    service:jmx:remote+https://jbosshost:9993 
    if SSL is enabled.
    

    jvmconnection2.png

  7. Enter the JBoss management Username and Password and then click on finish.

  8. Now it is connected to JBoss EAP server instance and the similar kind of entry will be added in the JVM Browser:

    jmcwindow2.png

  9. After getting connected you can monitor the mbean browser, mbean server, Runtime memory view as follows:

    jmc-mbean-browser.png

    jmc-mbean-server-general-view.png

    jmc-runtime-memory-view.png

Unsupported protocol issue
We need to add the "jboss-client.jar" file in the bootclasspath of the jmc because it contains the "remote-jmx" protocol which is specific to JBoss EAP6+ else it will throw Unsupported protocol: remoting-jmx .

This issue is fixed from 7.4 Update 3 onwards where the jboss-client.jar can be placed on the Java Mission Control droppings folder instead of modifying the jmc.ini by adding the -Xbootclasspath configuration.

In other words, place the jboss-client.jar (provided by JBoss EAP 7) in /path/to/jmc/dropins/. The dropins path in JMC is independent from JBOSS_HOME/bin/client/jboss-client.jar.

JDK 11+

Add these JVM arguments for the JVM Modular Classloader to allow access to the JMX classes needed:

--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.management/javax.management=ALL-UNNAMED
--add-opens=java.management/javax.management.openmbean=ALL-UNNAMED

Root Cause

As per link Java Mission Control, this tool is started with the release of Oracle JDK 7 Update 40 (7u40), Java Mission Control is bundled with the HotSpot JVM.

To configure Flight Recorder, refer How to use Oracle JDK Java Flight Recorder.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments