2017-08-11 31 views
0

我正在使用新鮮的ActiveMQ 5.10.0安裝,其中有一個名爲'testing'的隊列中有消息。我也換成了ACTIVEMQ_SUNJMX線斌/ ActiveMQ的啓用JMX:通過JMX訪問Apache ActiveMQ拋出異常代理未找到5.10

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. 

Accessing Apache ActiveMQ via JMX throws Exception類似,但沒有幫助。有任何想法嗎?

回答

1

您需要連接到activemq的jmx。 在CLI類型的jconsole中,或轉到JDK bin路徑並從命令行運行jconsole。 enter image description here 你會看到這個接口。連接到你的jmx。 enter image description here 準確地去這裏,看看你的對象。 完全複製到您的對象名稱。任何!差異,你不會得到你的經紀人。

+0

所以我可以 org.apache.activemq:type = Broker,BrokerName = TOM,connector = clientC onnectors,connectorName = openwire for consumer? – Sein3i8