1 Reply Latest reply on Nov 3, 2009 7:44 AM by Brett Cave

    MBean service either has no business interface or does not i

    Brett Cave Newbie

      I found the following thread, but no response as yet:

      We are busy with a jbas4.2.2 -> 5.1.0.GA migration, and have an mbean:


      @Service(objectName = "mycompany:service=MyMBeanService")
      public class MyMBeanService extends ServiceMBeanSupport implements MyMBeanServiceMBean {}

      public interface MyMBeanServiceMBean {}

      It is being mapped as an mbean, via jboss-service.xml:
      <mbean code="com.mycompany.mypackage.management.MyMBeanService"

      When I deploy this to JBAS 5, I get the following error:
      ERROR [org.jboss.management.j2ee.MBean] (main) Could not destroy JSR-77 MBean: mycompany:service=MyMBeanService
      javax.management.MBeanRegistrationException: preDeregister
       at org.jboss.mx.server.registry.BasicMBeanRegistry.unregisterMBean
      Caused by: javax.management.RunimeOperationsException
       at org.jboss.mx.server.MBeanServerImpl.removeNotficationLister
      Caused by: java.lang.IllegalArgumentException: The MBean mycompany:service=MyMBeanService exists but does not implement the NotifcationBroadcaster interface.

      So I added the implementation:
      public class MyMBeanService extends ServiceMBeanSupport implements MyMBeanServiceMBean, NotificationBroadcaster {}

      which results in the following error
      ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Real: name=vfszip:/usr/share/jbo
      ss/jboss-5.1.0.GA/server/all/farm/7-Project-ear.ear/ state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying Project.sar: Error creating ejb container MyMBeanService: Bean Class com.mycompany.project
      .management.MyMBeanService has no local, webservice, or remote interfaces defined and does not implement at least one business interface: MyMBeanService
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)

      I found a reference to the EJB 3 spec on JBoss Jira:
      "if a bean class implements a single interface, that interface will be assumed to be the business interface of the bean."

      And if a bean class implements more than 1 interface, then the business interface is specified through @Local or @Remote.

      So I added the annotation to MyMBeanServiceMBean:
      public interface MyMBeanServiceMBean {}

      After deploying this, I get the same error about the mbean existing, but not implementing NotificationBroadcaster interface (even though the bean does implement NotificationBroadcaster).

      I have also tried extending NotificationBroadcaster in the ServiceMBean:
      public interface MyMBeanServiceMBean extends NotificationBroadcaster {}

      which also still results in the not implementing notificationbroadcaster error.

      Not sure how to resolve this for this implementation (or perhaps a bug?)