Foo and FooMBean must be in the same package ?
When I register my MBean into the server, I got this exception:
server.container.Container does not implement the server.container.ContainerMBean
Note that the interface ContainerMBean actually resides in a different package, namelyserver.api.ContainerMBean.
Is this a real JMX Specification requirement ?
Thanks
[358 byte] By [
chihiroa] at [2007-11-14]

Yes. The JMX Specification says (p.42 of the 1.4 version): "The name of an MBean抯 Java interface is formed by adding the MBean suffix to the MBean抯 fully-qualified Java class name." See <http://java.sun.com/javase/6/docs/technotes/guides/jmx/JMX_1_4_specification.pdf>.
The Javadoc description of the javax.management package at <http://java.sun.com/javase/6/docs/api/javax/management/package-summary.html#package_description> also mentions this: "There are two ways to make a Java object that is an MBean with this management interface. One is for the object to be of a class that has exactly the same name as the Java interface but without the MBean suffix. So in the example the object would be of the class Configuration, in the same Java package as ConfigurationMBean. The second way is to use the StandardMBean class."
As that text mentions, if you need the interface to be in a different package from the implementation, you can use the class javax.management.StandardMBean.
Éamonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus/
Hi,
To complete Eamonn's answer:
a few weeks ago I wrote an article that specifically addresses this question.
javax.management.StandardMBean: When and Why.
http://blogs.sun.com/jmxetc/entry/javax_management_standardmbean_when_and
best regards,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/jmxetc