Wednesday, July 20, 2011

javax.management.NotCompliantMBeanException: MBean class bla does not implement DynamicMBean, neither follows the Standard MBean conventions

javax.management.NotCompliantMBeanException: MBean class com.acme.osb.CachesService does not implement DynamicMBean, neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.acme.osb.CachesService is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.acme.osb.CachesService: Class com.acme.osb.CachesService is not a JMX compliant MXBean)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:160)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:305)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)



http://download.oracle.com/javase/tutorial/jmx/mbeans/standard.html

"A standard MBean is defined by writing a Java interface called SomethingMBean and a Java class called Something that implements that interface. "


Stupid me, I had an implementation CachesService but the Interface was called CachesServiceIF... I have renamed it to CachesServiceMBean and everything works!

2 comments:

Ecca said...

the xxxMBean and the xxx class that implements the xxxMBean should also be in the same package.

It was a pain for me to find that simple factor out >.<

GeKis said...

It is also possible just mark any name/package interface by @MXBean annotation