Search code examples
javaannotationsmbeans

How to delpoy an Annotated MBean on jboss?


I am using an annotated pojo-MBean. But the mbean does not come up in the jmx-console after deployment. I believe that with annotations, usage of jboss-service.xml is not required. Could someone explain as to what I could probably be missing?
I am using version jboss 5.1 and my mbean looks something like this -

@Service(objectName = Statistics.ManagementJNDIName)
@Depends({ Statistics.MSEJNDIName })

public class StatisticsImplMBean  {
....
}

Solution

  • Have you defined a @Management interface for your MBean?

    Example:

    public interface IStatisticsMBean {
      void printStatistics();
      ....
    }
    
    @Management(IStatisticsMBean.class)
    @Service(objectName = Statistics.ManagementJNDIName)
    @Depends({Statistics.MSEJNDIName})
    public class StatisticsImplMBean {
    ....
    }