简体   繁体   English

当我尝试删除队列时,Activemq中出现了像InstanceNotFoundException这样的异常

[英]when i try to delete queue got exception like InstanceNotFoundException in Activemq

when i tried to delete one queue from broker(activemq) using below code , i got error like Instancenotfound exception.code following 当我尝试使用以下代码从broker(activemq)删除一个队列时,出现以下错误,例如Instancenotfound exception.code

JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url);
MBeanServerConnection conn = jmxc.getMBeanServerConnection();

String operationName="removeQueue";
String parameter="PostWithParameter_Queue"; //am given queue name
ObjectName activeMQ = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Broker");
if(parameter != null) {
    Object[] params = {parameter};
    String[] sig = {"java.lang.String"};
    conn.invoke(activeMQ, operationName, params, sig);
} else {
    conn.invoke(activeMQ, operationName,null,null);
} 

the exact error i got shown below 我得到的确切错误如下所示

   Exception in thread "main" javax.management.InstanceNotFoundException: org.apache.activemq:BrokerName=localhost,Type=Broker
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(Unknown Source)

i got this code from this below link 我从下面的链接中获得了此代码

http://www.consulting-notes.com/2010/08/monitoring-and-managing-activemq-with.html

please go through this link if am not clear.Thanks Advance 如果不清楚,请通过此链接。谢谢

Apache ActiveMQ 5.8 has changed the MBean naming. Apache ActiveMQ 5.8更改了MBean命名。 See details at the release notes which has a table with old vs new name: http://activemq.apache.org/activemq-580-release.html 请参阅发行说明中的​​详细信息,该发行说明中包含一个具有旧名称与新名称的表: http : //activemq.apache.org/activemq-580-release.html

The blog with the notes you found is from 2010, so its covering an older ActiveMQ version where the MBean names hasn't changed. 带有您发现的注释的博客来自2010年,因此该博客涵盖了一个较旧的ActiveMQ版本,该版本的MBean名称没有更改。

i got the answer.the code follows 我得到了答案。代码如下

ObjectName activeMQ = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Broker");

In the above code i mention BrokerName's and Type's first letter is capital .but it should be small letter like 在上面的代码中,我提到BrokerName和Type的首字母为大写字母,但应为小写字母,例如

ObjectName activeMQ = new ObjectName("org.apache.activemq:brokerName=localhost,type=Broker");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当activemq中客户端的空闲时间删除特定队列 - Delete specific queue when client's idle time in activemq 如何删除activemq中的特定队列 - how to delete a specific queue in activemq 关于删除队列的ActiveMQ信息 - ActiveMQ information about delete of queue MDB尝试连接到远程队列时在WebSphere 8中获取异常 - Getting an exception in WebSphere 8 when MDB try to connect to Remote Queue 当我尝试使用 Freemarker Spring Boot 删除元素时,出现异常 505 - i have got an exception 505 when I am trying to delete an element with Freemarker Spring Boot EJB3 MessageDrivenBean引发异常当使用外部ActiveMQ队列时,不信任此类可以序列化为ObjectMessage有效负载 - EJB3 MessageDrivenBean throws exception This class is not trusted to be serialized as ObjectMessage payload when consuming an external ActiveMQ Queue 当我尝试在 jboss 7.1 上使用自定义登录模块时出现“登录失败所有模块被忽略”异常 - i got "login failure all modules ignored" exception when i try to use my custom login module on jboss 7.1 保存子类别时出现休眠异常 - I got Hibernate Exception when saving subcategory 尝试用Java保存屏幕截图时出现异常 - Exception when I try to save a screenshot in Java 如何检查 Activemq 上是否存在队列 - how can I check if a queue exists on Activemq
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM