Accessing Apache ActiveMQ via JMX throws Exception Broker Not Found 5.10

…衆ロ難τιáo~ 提交于 2019-12-12 05:27:40

问题


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.

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.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!