Hi,
Below is my code, trying to get JMXConnector, MBeanServerConnection, JMSQueueControl and then accessing queue counters, so that i get message counter information. But it gives me error as below.
JMX_URL = "service:jmx:rmi:///jndi/rmi://11.222.23.333:9090/jmxrmi";
ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
JMSQueueControl queueControl = (JMSQueueControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,
on,
JMSQueueControl.class,
false);
String counters = queueControl.listMessageCounter();
MessageCounterInfo messageCounter = MessageCounterInfo.fromJSON(counters);
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: jmxrmi
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
It work when i use jmxrmiconnect instead, but that seems to be not right. The example i tried is from hornetQ examples jms/message-counters, but that doesn't work.
appreciate any help.