7 Replies Latest reply on Apr 19, 2002 11:20 AM by Adrian Brock

    Standard MBean interface and class packaging

    Mike Davis Newbie

      I couldn't find any other posts on this topic, so I hope I'm not re-opening something already discussed to death.

      If I have a standard MBean whose interface is in a different package, jbossmx throws a NotCompliantMBeanException saying that the "Class does not expose a management interface". In reading the spec, the requirements on this are a little vague:


      The name of an MBean’s Java interface is formed by adding the MBean suffix to the MBean’s Java class name.


      This doesn't define if the class name is the fully qualified class name or what.

      This seems like it would be an annoying constraint if you couldn't have an interface in a different package than the concrete class. Anyway its a simple fix in org.jboss.mx.metadata.StandardMetaData. (once I get my compiling working I'll test my fix and post it here for review, if anyone cares?).

      There is, currently, the same issue with the Sun RI. See http://java.sun.com/products/JavaManagement/jmx_community_bug_list.html Delayed RFE #45:

      <sun-ri-buglist>
      RFE: remove constraint of having MBean interface and MBean class in the same package
      </sun-ri-buglist>

      MikeD

        • 1. Re: Standard MBean interface and class packaging
          Adrian Brock Master

          Hi,

          You should read the class name as fully qualified unless
          it says otherwise ;-)

          Notice is marked RFE (Request for Enhancement) rather
          than bug.

          What is your simple fix? How does it cope with the
          following?

          package one;

          import two.MyClassMBean;
          import three.MyClassMBean;

          public class MyClass
          implements two.MyClassMBean, three.MyClassMBean;

          A bit pathological, but I think this is why the
          RFE is in the delayed section.
          I suspect that if/when the spec resolves it, the
          example above will give a NotCompliantMBeanException.

          Regards,
          Adrian

          • 2. Re: Standard MBean interface and class packaging
            Peter Callies Newbie

            Have the requirements for exposing a management interface changed from JBoss 2 to JBoss 3? In JBoss 2 I didn't have to marry my code to JBoss code to create a manageable service. I just had to expose the Service methods I wanted to implement.

            I have developed a service (EDIProcessFactory) that implements an interface (EDIProcessFactoryMBean) that contains the following methods:
            public void start() throws Exception;
            public void stop() throws Exception;
            public void setLogfileName(String filename);
            public void setConfigKey(String key);

            The class and the interface are in the same package.

            I added a *-service.xml file to the deploy directory that looks like this:


            com.mckhboc.realtime.common.edi.interface.gateway.starInbound
            starin.log



            I get a NotCompliantMBeanException stating "Class does not expose a management interface".

            I'm using the 3.0 source code I checked out last weekend.

            • 3. Re: Standard MBean interface and class packaging
              Adrian Brock Master

              Strange,

              The Log4JService and Security MBeans do the same.

              You are sure you have

              EDIProcessFactory
              implements EDIProcessFactoryMBean

              The message you are receiving implies this is not the
              case?

              Regards,
              Adrian

              • 4. Re: Standard MBean interface and class packaging
                Peter Callies Newbie

                Pretty sure:

                package com.mckhboc.realtime.common.edi.process;

                <bunch of imports>

                public class EDIProcessFactory implements EDIProcessFactoryMBean {



                package com.mckhboc.realtime.common.edi.process;

                public interface EDIProcessFactoryMBean {

                • 5. Re: Standard MBean interface and class packaging
                  Peter Callies Newbie

                  I looked further up in my log file and I found the following. Why would JBoss have trouble opening my jar file? I created it using the standard jar command and saved it in JBoss's lib directory.

                  2002-04-18 18:01:19,551 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar
                  2002-04-18 18:01:19,551 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar
                  2002-04-18 18:01:19,601 DEBUG [org.jboss.system.UnifiedClassLoader] New UCL with url file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/server/default/tmp/deploy/C/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar/11.edi.jar
                  2002-04-18 18:01:19,621 DEBUG [org.jboss.deployment.JARDeployer] no xmls found
                  2002-04-18 18:01:19,621 DEBUG [org.jboss.deployment.MainDeployer] using deployer org.jboss.deployment.JARDeployer@711404
                  2002-04-18 18:01:19,641 DEBUG [org.jboss.deployment.MainDeployer] found 7 subpackages of file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar
                  2002-04-18 18:01:19,641 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: njar:file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/server/default/tmp/deploy/C/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar/11.edi.jar^/com/mckhboc/realtime/common/edi/1015280596488_temp.jar
                  2002-04-18 18:01:19,641 DEBUG [org.jboss.system.UnifiedClassLoader] New UCL with url njar:file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/server/default/tmp/deploy/C/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar/11.edi.jar^/com/mckhboc/realtime/common/edi/1015280596488_temp.jar
                  2002-04-18 18:01:19,691 WARN [org.jboss.deployment.JARDeployer] looking inside jar failed; ignoring
                  java.util.zip.ZipException: error in opening zip file
                  at java.util.zip.ZipFile.open(Native Method)
                  at java.util.zip.ZipFile.(ZipFile.java:110)
                  at java.util.jar.JarFile.(JarFile.java:115)
                  at java.util.jar.JarFile.(JarFile.java:57)
                  at sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:52)
                  at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:41)
                  at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:61)
                  at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:88)
                  at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:72)
                  at org.jboss.deployment.JARDeployer.accepts(JARDeployer.java:133)
                  at org.jboss.deployment.MainDeployer.findDeployer(MainDeployer.java:711)
                  at org.jboss.deployment.MainDeployer.init(MainDeployer.java:564)
                  at org.jboss.deployment.MainDeployer.init(MainDeployer.java:582)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:505)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:447)
                  at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                  at $Proxy3.deploy(Unknown Source)
                  at org.jboss.deployment.SARDeployer.parseXMLClasspath(SARDeployer.java:499)
                  at org.jboss.deployment.SARDeployer.init(SARDeployer.java:190)
                  at org.jboss.deployment.MainDeployer.init(MainDeployer.java:575)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:505)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:480)
                  at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:462)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:447)
                  at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:319)
                  at org.jboss.system.server.ServerImpl.start(ServerImpl.java:213)
                  at org.jboss.Main.boot(Main.java:138)
                  at org.jboss.Main$1.run(Main.java:371)
                  at java.lang.Thread.run(Thread.java:484)
                  2002-04-18 18:01:19,841 DEBUG [org.jboss.deployment.MainDeployer] No deployer found for url: njar:file:/C:/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/server/default/tmp/deploy/C/jboss-tip/jboss-all/build/output/jboss-3.0.0beta2/lib/edi.jar/11.edi.jar^/com/mckhboc/realtime/common/edi/1015280596488_temp.jar

                  • 6. Re: Standard MBean interface and class packaging
                    Peter Callies Newbie

                    Sorry for the bombardment of postings, but I just deployed this service successfully in JBoss 2.4.4.

                    • 7. Re: Standard MBean interface and class packaging
                      Adrian Brock Master

                      I can't tell you what is wrong with the jar,
                      the error isn't very informative.

                      Are you using different accounts? Might this be an
                      authority problem?

                      Have you tried creating the jar again? Or running
                      jar -tf your.jar

                      Regards,
                      Adrian