MalformedURLException Unsupported protocol remoting-jmx when JMX client tries to connect to JBoss EAP 6 MBean Server

Solution Verified - Updated -

Issue

  • Getting Unsupported protocol when trying to connect to JMX using remoting-jmx protocol from a client application running in JBoss EAP 6.0.x. The exception is:
03:09:24,429 ERROR java.net.MalformedURLException: Unsupported protocol: remoting-jmx
03:09:24,430 ERROR   at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:327)
03:09:24,430 ERROR   at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)
03:09:24,430 ERROR   at com.jboss.examples.ejb.HelloBean.printMBeanCount(PrintMBeansSingleton.java:57)
                     ...
  • The client code connection is:
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

@Stateless
public class HelloBean {
  public int printMBeanCount() throws Exception {
    String host = "localhost";
    int port = 9999;  // management-native port
    String urlString = System.getProperty("jmx.service.url","service:jmx:remoting-jmx://" + host + ":" + port);
    JMXConnector jmxConnector = null;
    try {
      JMXServiceURL serviceURL = new JMXServiceURL(urlString);
      JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);
      MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
      return connection.getMBeanCount();
    } finally {
      if(jmxConnector != null) jmxConnector.close();
    }
  }

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content