我正在使用一个新的ActiveMQ 5.10.0安装,其中我在一个名为“测试”的队列中有一条消息。我还替换了bin/tivemq中的ACTIVEMQ_SUNJMX行以启用JMX:
ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JMXServiceURL url1 = new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://10.222.222.222:1099/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url1);
MBeanServerConnection conn = jmxc.getMBeanServerConnection( );
ObjectName activeMQ = new
ObjectName("org.apache.activemq:type=Broker,BrokerName=TOM");
System.out.println(newProxyInstance(conn, activeMQ, BrokerViewMBean.class, true).toString( ));
Set<ObjectName> brokers = conn.queryNames(activeMQ, null);
if (brokers.size() == 0) {
throw new IOException("No broker could be found in the JMX.");
}
抛出的异常是
Exception in thread "main" java.io.IOException: No broker could be found in
the JMX.
类似于通过JMX访问Apache ActiveMQ会引发异常,但没有帮助。有什么想法吗?