我目前正在尝试从ActiveMQ中检索统计信息。我使用ActiveMQ 5.11.1并将statisticsBrokerPlugin添加到配置文件中。正如在此处指定的那样:http://activemq.apache.org/statisticsplugin.html,我向ActiveMQ.Statistics.Subscription发送空消息以检索所有队列和主题订阅。
运行时,大多数情况下发送邮件时会出错。类似的东西:
Caused by: javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=prod.import.csv,endpoint=Consumer,clientId=ID_tadpole-import-5-38631-1438235942638-2_17,consumerId=ID_tadpole-import-5-38631-1438235942638-3_17_1_14503
以下是代码的有用部分:
val factory = new ActiveMQConnectionFactory(activeMQConn)
factory.setWatchTopicAdvisories(false)
val connection = factory.createConnection()
connection.start()
val session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)
val replyTo = session.createTemporaryQueue()
val consumer = session.createConsumer(replyTo)
val queueName = "ActiveMQ.Statistics.Subscription"
val testQueue = session.createQueue(queueName)
val producer = session.createProducer(testQueue)
val msg = session.createMessage()
msg.setJMSReplyTo(replyTo)
producer.send(msg) // this will trigger the error
知道如何解决这个问题吗?
由于
PS:
这里的堆栈跟踪:
javax.jms.JMSException: java.lang.reflect.UndeclaredThrowableException: null
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1420)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1346)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1904)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:288)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:223)
at org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
at com.fliptop.common.metrics.activemq.ActiveMQStatistics.com$fliptop$common$metrics$activemq$ActiveMQStatistics$$recurringFetch$1(ActiveMQStatistics.scala:75)
at com.fliptop.common.metrics.activemq.ActiveMQStatistics$$anonfun$2.apply$mcV$sp(ActiveMQStatistics.scala:113)
at akka.actor.Scheduler$$anon$5.run(Scheduler.scala:79)
at akka.actor.LightArrayRevolverScheduler$$anon$2$$anon$1.run(Scheduler.scala:242)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:401)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.Throwable: java.lang.reflect.UndeclaredThrowableException: null
at com.sun.proxy.$Proxy9.getDestinationName(Unknown Source)
at org.apache.activemq.plugin.StatisticsBroker.prepareSubscriptionMessage(StatisticsBroker.java:241)
at org.apache.activemq.plugin.StatisticsBroker.sendSubStats(StatisticsBroker.java:231)
at org.apache.activemq.plugin.StatisticsBroker.send(StatisticsBroker.java:143)
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:157)
at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:541)
at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:768)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:334)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:188)
at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:270)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=prod.import.opportunity,endpoint=Consumer,clientId=ID_tadpole-import-1-40652-1438591283770-2_16,consumerId=ID_tadpole-import-1-40652-1438591283770-3_16_1_35720
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:643)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:267)
... 16 more