Can I create a generic JMX server resource in JBoss ON that connects to JBoss EAP 6 or 7?

Solution Verified - Updated

Environment

  • Red Hat JBoss Operations Network (ON) 3.1.2, 3.2, 3.3
  • Red Hat JBoss Enterprise Application Platform (EAP) 6.0, 6.0.1, 6.4, 7
  • Red Hat JBoss Application Server (AS) 7 plug-in for JBoss ON

  • Red Hat JBoss Enterprise Application Platform 7 (EAP7) plug-in for JBoss ON

  • JBoss EAP (versions 6.0 and 6.1) has been configured with the JMX module enabled (urn:jboss:domain:jmx) and its show-model element set to true:

              <subsystem xmlns="urn:jboss:domain:jmx:1.1">
                  <show-model value="true"/>
                  <remoting-connector/>
              </subsystem>
    
  • JBoss EAP (versions after 6.1) has been configured in the following way:

             <subsystem xmlns="urn:jboss:domain:jmx:1.3">
                 <expose-resolved-model/>
                 <expose-expression-model/>
                 <remoting-connector/>
              </subsystem>
    

    Note: The existance of the expose-resolved-model child is translated into the show-model=true attribute in the older versions of EAP 6 (6.0.1 and 6.1)

Issue

  • How to view JMX services in JON server to perform operations like in JConsole?
  • I get the exception "Necessary classes not found for remote connection...".

  • How to configure the JMX plug-in in to connect to JBoss Application Server (AS) 7 or JBoss Enterprise Application Platform (EAP) 6/7?

  • JMX server connection fails with the following error:

      ERROR [WorkerThread#0[127.0.0.1:42524]] (rhq.core.pc.inventory.InventoryManager)- Manual add failed for resource of type [JMX Server] and parent resource id [10001]
      java.lang.reflect.UndeclaredThrowableException
          at $Proxy70.discoverResource(Unknown Source)
          at org.rhq.core.pc.inventory.InventoryManager.discoverResource(InventoryManager.java:362)
          at org.rhq.core.pc.inventory.InventoryManager.manuallyAddResource(InventoryManager.java:738)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          ...
      Caused by: java.lang.Exception: Discovery component invocation failed.
          at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:297)
          ...
      Caused by: java.lang.RuntimeException: Failed to connect to JVM with connector address [service:jmx:remoting-jmx://127.0.0.1:9999].
          at org.rhq.plugins.jmx.JMXDiscoveryComponent.discoverResource(JMXDiscoveryComponent.java:241)
          ...
      Caused by: org.mc4j.ems.connection.EmsConnectException: Could not connect [service:jmx:remoting-jmx://127.0.0.1:9999] org.mc4j.ems.connection.EmsConnectException: Malformed url
          at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:106)
          at org.rhq.plugins.jmx.JMXDiscoveryComponent.discoverResource(JMXDiscoveryComponent.java:234)
          ... 10 more
      Caused by: org.mc4j.ems.connection.EmsConnectException: Malformed url
          at org.mc4j.ems.impl.jmx.connection.support.providers.JMXRemotingConnectionProvider.doConnect(JMXRemotingConnectionProvider.java:160)
          at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:101)
          ... 11 more
      Caused by: java.net.MalformedURLException: Unsupported protocol: remoting-jmx
          at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:345)
          at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:266)
          at org.mc4j.ems.impl.jmx.connection.support.providers.JMXRemotingConnectionProvider.doConnect(JMXRemotingConnectionProvider.java:143)
          ... 12 more
    
  • Can the agent connect to JBoss EAP 6 as a JMX client?

Resolution

If the JBoss resource has its JMX module deployed and enabled, a generic JMX client connection can be established using the JMX plug-in included with the JBoss ON installation. To connect to the JMX server you will need to use a valid JMX service URL and include jboss-client.jar in the resource's class path. The following settings can be used to connect to a JBoss EAP 6/7 standalone server instance:

PropertyValue
Type:JSR 160
Connector Address:service:jmx:<protocol>://127.0.0.1:9999
Install URI:<JBOSS_HOME>
Principal:<USERNAME>
Credentials:<PASSWORD>
Additional Class Path Entries:<JBOSS_HOME>/bin/client/*.jar

Replace <protocol> with remoting-jmx for EAP 6 or remote+http for EAP 7. Additionally, replace <JBOSS_HOME> with the complete path to the JBoss EAP 6/7 installation's root or home directory. Make sure to provide a valid username and password if the connection is remote.

If the target JBoss EAP resource is running in domain mode, you will need to specify the host and port for the application connection for one of the managed servers in the domain. The default port is 4447. Please note that in JBoss EAP 6, the JMX server is read-only when in domain mode.

Root Cause

For a JMX client to connect to a JMX server, it must have access to the required classes to establish a connection. For a basic connection to a JBoss EAP 6/7 server, jboss-client.jar contains the necessary classes.

Depending on the return type of MBean attributes and their operations, it may be necessary to include other classes in the Additional Class Path Entries setting for the JMX connection.

SBR
Category

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.