SimpleMBean, interface needs to be inside the same package

View: New views
3 Messages — Rating Filter:   Alert me  

SimpleMBean, interface needs to be inside the same package

by Erik Vaneylen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I've recently updated for JMX 1.1 to JMX 1.2.
In the project I'm working on, I used a seperate package (mbeans) for all interfaces of my SimpleMBeans. It makes it easy to keep track of wich classes have been modified for monitoring.

But in JMX 1.2, it seems that it is not possible to work the same way, I get an error that I don't implement the interface in the package, or the dynamic interface. As everything was working fine before, I know that I implemented the interface correctly.

I've written a small test program, this is the error I get:

Exception in thread "main" javax.management.NotCompliantMBeanException: testing.Simple does not implement the testing.SimpleMBean interface or the DynamicMBean interface
    at com.sun.jmx.mbeanserver.Introspector.testCompliance(Introspector.java:198)
    at com.sun.jmx.mbeanserver.Introspector.testCompliance(Introspector.java:150)
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.buildMBeanInfo (StandardMetaDataImpl.java:116)
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.testCompliance(StandardMetaDataImpl.java:149)
    at com.sun.jmx.mbeanserver.MetaDataImpl.testCompliance(MetaDataImpl.java:125)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)
    at testing.Server.main (Server.java:16)

While it does implement testing.SimpleMBean

Is this suppose to be default behavior?

regards,

Erik
=========================================================================== For information on the Java Management extensions (JMX), please visit our home page at http://java.sun.com/products/JavaManagement/ The JMX-FORUM archives are accessible at http://archives.java.sun.com To unsubscribe, send email to listserv@... and include in the body of the message "signoff JMX-FORUM". For general help, send email to listserv@... and include in the body of the message "help".

Parent Message unknown Re: SimpleMBean, interface needs to be inside the same package

by eamonn.mcmanus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Erik,

The JMX 1.2 Specification clarified the rule linking an implementation class
like Simple with its management interface SimpleMBean.  It explicitly stated
that Simple and SimpleMBean must be in the same package.  The Reference
Implementation had always behaved this way, but some other implementations
allowed Simple and SimpleMBean to be in different packages provided that the
names of the class and of the interface were Foo and FooMBean.  I assume
that you were using one of these other implementations for your JMX 1.1.

If you need class and interface to be in different packages, you should use
the class javax.management.StandardMBean.

Regards,
--
Éamonn McManus   JMX Spec Lead   http://weblogs.java.net/blog/emcmanus/

===========================================================================
For information on the Java Management extensions (JMX), please visit
our home page at http://java.sun.com/products/JavaManagement/
The JMX-FORUM archives are accessible at http://archives.java.sun.com
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JMX-FORUM".  For general help, send email to
listserv@... and include in the body of the message "help".

Re: SimpleMBean, interface needs to be inside the same package

by daniel.fuchs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eamonn McManus wrote:

> Erik,
>
> The JMX 1.2 Specification clarified the rule linking an implementation class
> like Simple with its management interface SimpleMBean.  It explicitly stated
> that Simple and SimpleMBean must be in the same package.  The Reference
> Implementation had always behaved this way, but some other implementations
> allowed Simple and SimpleMBean to be in different packages provided that the
> names of the class and of the interface were Foo and FooMBean.  I assume
> that you were using one of these other implementations for your JMX 1.1.
>
> If you need class and interface to be in different packages, you should use
> the class javax.management.StandardMBean.

See: javax.management.StandardMBean: When and Why.
http://blogs.sun.com/jmxetc/entry/javax_management_standardmbean_when_and
which talks about this. From this blog you'll note that an alternative
to using StandardMBean is to use MXBeans (on JDK 6).

Using MXBeans while keeping interoperability with older clients will
only be possible in this case if your SimpleMBean only uses simple
types.

Hope this helps,

-- daniel
http://blogs.sun.com/jmxetc


> Regards,
> --
> Éamonn McManus   JMX Spec Lead   http://weblogs.java.net/blog/emcmanus/

===========================================================================
For information on the Java Management extensions (JMX), please visit
our home page at http://java.sun.com/products/JavaManagement/
The JMX-FORUM archives are accessible at http://archives.java.sun.com
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JMX-FORUM".  For general help, send email to
listserv@... and include in the body of the message "help".