How to connect JBoss 7.1.1 remoting -jmx via java code?

advertisements

I have a JBoss 7.1.1 server, for which I want to write jmx client. As far I understood, jboss 7.1.1 is not using typical rmi based jmx and they have given a layer of remoting-jmx over native management. I am using following code:

JMXServiceURL address = new JMXServiceURL("service:jmx:remoting-jmx://localhost:9999");

Map env = JMXConnectorConfig.getEnvironment(paramtbl);

JMXConnector connector = JMXConnectorFactory.connect(address, env);

But it is giving following exception:

java.net.MalformedURLException: Unsupported protocol: remoting-jmx

I googled it and the following thread seems relevant: https://community.jboss.org/thread/204653?tstart=0

It asks to add jboss's libraries to my classpath. I tried that also but still getting same exception.


I got the same exception when trying to get a JmxServiceUrl. Make sure that in your standalone.xml you have the following:

<subsystem xmlns="urn:jboss:domain:jmx:1.1"> <show-model value="true"/> <remoting-connector use-management-endpoint="true" /> </subsystem>

And you should include in project classpath the jar named: jboss-client.jar, it can be found in JBOSS_DIRECTORY/bin/client. In fact, the JMX client must include that jar in its classpath.

This tip fixed the problem for me..Hope it will be helpful for you