JMX “javax.management.NotCompliantMBeanException” 异常解决
2011-07-19 10:36
387 查看
昨天同事在JBoss中部署MBean时一直报错:
Caused by: javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:102)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:182)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)
at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1350)
at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:345)
at org.jboss.system.ServiceCreator.install(ServiceCreator.java:157)
at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:451)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171)
... 81 more
几个人查了良久,试了能想到的一切方法,仍不得解。网上Google,Interface和实现必须放在同一个包内,改,再部署,仍报错。同事提了一句是不是要改成Sar包,改,再部署,仍旧报错。MBean命名有要求,实现类名必须是接口名去掉MBean,改,再部署,还是错措错!!!最后大家都已头昏眼花,不得不暂时作罢,次日再战。
今日一早起来,略读了《Java Management Extension》,书中 2.2.1节 Describing the Management Interface 正好讲到了NotCompliantMBeanException。遂一一对照,检查代码。
2.2.1.1 Pattern #1: Defining, naming, and implementing the MBean interface
接口必须定义成Public的。
public interface QueueMBean {
// management interface goes here. . .
}
实现类必须implements 接口的同时,名字也是大有讲究。假如接口名叫 XYZMBean ,那么实现名就必须一定是 XYZ,而且是大小写敏感的。真是差之毫厘谬以NotCompliant。
public class Queue implements QueueMBean {
// implementation of QueueMBean
// and other stuff here. . .
}
再仔细一瞅同事的代码,顿悟。接口名去掉MBean后和实现类名差那么一个字母,怎么昨天我们三个人都没有看出来呢?把名字一改,再部署,OK了。
Caused by: javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:102)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:100)
at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:182)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)
at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1350)
at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:345)
at org.jboss.system.ServiceCreator.install(ServiceCreator.java:157)
at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:451)
at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171)
... 81 more
几个人查了良久,试了能想到的一切方法,仍不得解。网上Google,Interface和实现必须放在同一个包内,改,再部署,仍报错。同事提了一句是不是要改成Sar包,改,再部署,仍旧报错。MBean命名有要求,实现类名必须是接口名去掉MBean,改,再部署,还是错措错!!!最后大家都已头昏眼花,不得不暂时作罢,次日再战。
今日一早起来,略读了《Java Management Extension》,书中 2.2.1节 Describing the Management Interface 正好讲到了NotCompliantMBeanException。遂一一对照,检查代码。
2.2.1.1 Pattern #1: Defining, naming, and implementing the MBean interface
接口必须定义成Public的。
public interface QueueMBean {
// management interface goes here. . .
}
实现类必须implements 接口的同时,名字也是大有讲究。假如接口名叫 XYZMBean ,那么实现名就必须一定是 XYZ,而且是大小写敏感的。真是差之毫厘谬以NotCompliant。
public class Queue implements QueueMBean {
// implementation of QueueMBean
// and other stuff here. . .
}
再仔细一瞅同事的代码,顿悟。接口名去掉MBean后和实现类名差那么一个字母,怎么昨天我们三个人都没有看出来呢?把名字一改,再部署,OK了。
相关文章推荐
- JMX “javax.management.NotCompliantMBeanException” 异常解决
- javax.management.NotCompliantMBeanException
- javax.management.NotCompliantMBeanException 异常处理
- EJB3.0异常总结---Exception in thread "main" javax.naming.NameNotFoundException: StatelessEjbBean not bou
- 关于Eclipse启动时报ClassNotFoundException: javax.xml.parsers.SAXParserFactory异常的解决
- 解决jetty7.0.pre5启动时报ClassNotFoundException: javax.interceptor.InvocationContext异常的问题
- java.lang.ClassNotFoundException:javax.el.ELResolver异常解决办法
- jmx中NotCompliantMBeanException
- 解决ERROR - unregister mbean error javax.management.InstanceNotFoundException: com.alibaba.druid:type=
- CentsOS6 Tomcat7 报javax.management.InstanceNotFoundException 解决办法
- java.lang.ClassNotFoundException: javax.persistence.EntityListeners异常解决
- 解决ERROR - unregister mbean error javax.management.InstanceNotFoundException: com.alibaba.druid:type=
- javax.el.PropertyNotFoundException: Property 'reviewcontent' not found on type javabean.YbReview解决方法
- 解决jetty7.0.pre5启动时报ClassNotFoundException: javax.interceptor.InvocationContext异常的问题
- tomcat6下,关于java.lang.ClassNotFoundException: javax.el.FunctionMapper 异常解决办法
- spring异常解决方法:org.springframework.beans.factory.BeanCreationNotAllowedException
- 解决:ould not find a getter for porDate in class com.bc.bean.PortalSheet Caused by: org.hibernate.PropertyNotFoundException: Could
- javax.persistence.NoResultException: No entity found for query 异常解决办法
- ClassNotFoundException异常的解决方法
- Could not load java.net.BindException异常的解决办法