Unable to access Mbean Server via remoting-jmx
deepak_a Sep 19, 2014 5:52 AMAll,
I have a MBean server in one JVM (service details shown below)
INFO JMX Connector thread started and listening at: service:jmx:rmi:///jndi/rmi://LDN-LRM-PC-189:19999/jmxrmi/camel
I am trying to access the Mbean server from within my app deployed in EAP 6.3.0
But unable to connect to the MBean Server.
I tried to connect via a standalone app
import java.util.Date;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
public class JMXExample {
public static void main(String[] args) throws Exception {
String host = "LDN-LRM-PC-189";
int port = 19999; // management-native port
String urlString =
System.getProperty("jmx.service.url","service:jmx:remoting-jmx://" + host + ":" + port);
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
ObjectName mBeanName = new ObjectName("java.lang:type=Runtime");
String attributeName = "StartTime";
Object attrVal = connection.getAttribute(mBeanName, attributeName);
System.out.println("Value via JMX: " + new Date((Long) attrVal));
//Invoke on the JBoss AS MBean server
int count = connection.getMBeanCount();
System.out.println(count);
jmxConnector.close();
}
}
Following exception is thrown
Exception in thread "main" java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.remotingjmx.RemotingConnector.internalRemotingConnect(RemotingConnector.java:235)
at org.jboss.remotingjmx.RemotingConnector.internalConnect(RemotingConnector.java:148)
at org.jboss.remotingjmx.RemotingConnector.connect(RemotingConnector.java:99)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at com.lombardrisk.ejb3.JMXExample.main(JMXExample.java:23)
I have added jboss-cleint.jar to the classpath.
Still facing the same issue. Is there any other JVM argument that is needed to connect via remoting-jmx?
This is used to work with Jboss 5 (which used jnp-cleint).
remoting-jmx does not seem work at all. Can some one point to the right solution for this.
regards,
D