问题
I'm using a fresh ActiveMQ 5.10.0 installation, where I have a message in a queue called 'testing'. I also replaced the ACTIVEMQ_SUNJMX line in bin/activemq to enable 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.");
}
The exception thrown is
Exception in thread "main" java.io.IOException: No broker could be found in
the JMX.
Similar to Accessing Apache ActiveMQ via JMX throws Exception but did not help. Any ideas?
回答1:
You need to connect to activemq's jmx . In CLI type jconsole or go to your JDK bin path and run jconsole from command line.


来源:https://stackoverflow.com/questions/45640731/accessing-apache-activemq-via-jmx-throws-exception-broker-not-found-5-10