简体   繁体   中英

Accessing Apache ActiveMQ via JMX throws Exception Broker Not Found 5.10

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?

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. 在此处输入图片说明 You will see this interface. Connect to your jmx. 在此处输入图片说明 Go here exactly and look at your object. Copy exactly into your object name. Any! difference and you will not get your broker.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM