英文:
Can't receive messages in ActiveMQ Artemis through the JMX
问题
I'm trying to get messages from the queue through the JMX, but it gives me an error:
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy6.getBrokerId(Unknown Source)
at jmxClientUIPConsole.JMXExample.main(JMXExample.java:93)
Caused by: javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1083)
...
Code ObjectName:
ObjectName mbeanNameQueue = new ObjectName("org.apache.activemq:type=Broker,brokerName=static-broker1,destinationType=Queue,destinationName=tmp_queue2");
org.apache.activemq.broker.jmx.QueueViewMBean queueView = JMX.newMBeanProxy(mbsc, mbeanNameQueue, org.apache.activemq.broker.jmx.QueueViewMBean.class);
System.out.println(queueView.browseAsTable());
Using version:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.8.0</version>
</dependency>
Tried to enter in ObjectName: org.apache.activemq:type=Broker,brokerName=localhost
and org.apache.activemq:BrokerName=localhost,Type=Broker
英文:
I'm trying to get messages from the queue through the JMX, but it gives me an error
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy6.getBrokerId(Unknown Source)
at jmxClientUIPConsole.JMXExample.main(JMXExample.java:93)
Caused by: javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1083)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBeanInfo(DefaultMBeanServerInterceptor.java:1353)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.getMBeanInfo(JmxMBeanServer.java:920)
at java.base/jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerBuilder$MBeanInvocationHandler.invoke(ArtemisMBeanServerBuilder.java:96)
at com.sun.proxy.$Proxy30.getMBeanInfo(Unknown Source)
at org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerGuard.handleGetAttribute(ArtemisMBeanServerGuard.java:77)
at org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerGuard.invoke(ArtemisMBeanServerGuard.java:62)
at org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerBuilder$MBeanInvocationHandler.invoke(ArtemisMBeanServerBuilder.java:76)
at com.sun.proxy.$Proxy30.getAttribute(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1443)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:637)
at java.base/jdk.internal.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164)
at jdk.remoteref/jdk.jmx.remote.internal.rmi.PRef.invoke(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:904)
at java.management/javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:273)
... 2 more
Code ObjectName:
ObjectName mbeanNameQueue = new ObjectName("org.apache.activemq:type=Broker,brokerName=static-broker1,destinationType=Queue,destinationName=tmp_queue2");
org.apache.activemq.broker.jmx.QueueViewMBean queueView = JMX.newMBeanProxy(mbsc, mbeanNameQueue, org.apache.activemq.broker.jmx.QueueViewMBean.class);
System.out.println(queueView.browseAsTable());
Using verion:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.8.0</version>
</dependency>
Tried to enter in ObjectName: org.apache.activemq:type=Broker,brokerName=localhost and org.apache.activemq:BrokerName=localhost,Type=Broker
答案1
得分: 1
这是翻译好的内容:
看起来你正在尝试在ActiveMQ Artemis中使用ActiveMQ "Classic"中的JMX MBean ObjectNames。这是行不通的。ActiveMQ Artemis中的管理API与ActiveMQ "Classic"不同。
你可以在文档中找到关于ActiveMQ Artemis管理API的一般信息。要了解更多关于各种可用管理操作的信息,请参阅这些接口的Javadoc。它们位于org.apache.activemq.artemis.api.core.management
包中,它们的名称以Control
结尾(例如,ServerControl
、QueueControl
等)。
在你的情况下,你可能想要使用QueueControl
上的browse()
操作。
英文:
It appears you're attempting to use JMX MBean ObjectNames from ActiveMQ "Classic" in ActiveMQ Artemis. That won't work. The management API in ActiveMQ Artemis is different from ActiveMQ "Classic."
You can find general information about the ActiveMQ Artemis management API in the documentation. To learn more about the various available management operations, see the Javadoc for these interfaces. They are located in the org.apache.activemq.artemis.api.core.management
package and they are named with the word Control
at the end (e.g. ServerControl
, QueueControl
, etc.).
In your case, you'll probably want to use the browse()
operation on the QueueControl
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论