1 Reply Latest reply on Sep 23, 2002 6:44 AM by Derek Hulley

    Minimalistic MBean

    Pranas Baliuka Newbie

      Hi all,

      -- Who nows how to write minimalistic jboss-3.0.2 MBean?
      Error message "Class does not expose a management interface", but my MBean declares org.jboss.system.ServiceMBeanSupport and org.jboss.system.ServiceMBean ?!!!?

      PLEASE HELP!

      CODE:
      //----------------------------------------------
      package ubp.mbean;

      public class Xxx
      extends org.jboss.system.ServiceMBeanSupport
      implements org.jboss.system.ServiceMBean {
      public Xxx() {} // Constructor
      public String getName() {return "xxx";} // getName
      public void createService() throws Exception {}
      public void startService() throws Exception {}
      public void stopService() throws Exception {}
      public void destroyService() throws Exception {}
      }
      //----------------------------------------------
      DESCRIPTOR xxx-service.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>





      <!-- ----------------------------------------- -->

      ERROR:
      ...
      09:51:44,250 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss-3.0.2/server/default/deploy/xxx-service.xml
      09:51:44,250 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss-3.0.2/server/default/lib/xxx.jar
      09:51:44,281 INFO [MainDeployer] Deployed package: file:/D:/jboss-3.0.2/server/default/lib/xxx.jar
      09:51:44,296 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@627fec40{ url=file:/D:/jboss-3.0.2/server/default/deploy/xxx-service.xml, deployedLastModified=0 }
      org.jboss.deployment.DeploymentException: Class does not expose a management interface: ubp.mbean.Xxx; - nested throwable: (javax.management.NotCompliantMBeanException: Class does not expose a management interface: ubp.mbean.Xxx)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:155)
      at org.jboss.system.ServiceController.install(ServiceController.java:224)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy3.install(Unknown Source)
      at org.jboss.deployment.SARDeployer.create(SARDeployer.java:209)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:755)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:615)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:225)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:202)
      Caused by: javax.management.NotCompliantMBeanException: Class does not expose a management interface: ubp.mbean.Xxx
      at org.jboss.mx.metadata.MBeanCapability.of(MBeanCapability.java:66)
      at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:156)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:975)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:922)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:294)
      at org.jboss.system.ServiceCreator.install(ServiceCreator.java:86)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:167)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:130)
      ... 25 more

        • 1. Re: Minimalistic MBean
          Derek Hulley Newbie

          Hi,

          I found it very useful to read the actual specification. In there, it explains the hierarchy that conforms to the MBean spec.

          You have to have an interface of your own that is named as the base class of your mbean plus "MBean". In your case that would be XxxMBean. Then your actual MBean implementation has to implement it. That is all that your MBean is missing. Using the helper classes (like you have done) is a good idea as well.

          Check out the JBoss code:
          - org.jboss.mx.metadata.StandardMetaData.java
          method:
          - findStandardInterface(Class concrete, Class[] interfaces)

          You will see that the names of the interfaces that your MBean implement are checked (up the hierarchy) until an interface is found that conforms to the naming convention. That interface is then used as the definition of the business methods available to the MBean.