1 Reply Latest reply on Apr 25, 2015 4:02 AM by Flemming Harms

    Easiest way to register MBean with JBoss WildFly 8.1

    Jeffrey Metcalf Newbie

      Hi All,


      I was wondering if someone could direct me to the easiest way to register an MBean with JBoss WildFly 8.1.  I understand that previous versions of JBoss AS supported the following EJB3 extension annotation:



      This was used to mark certain EJBs (annotated with @Service) to be automatically registered with the MBean server.  I cannot find this annotation in jboss-ejb3-ext-api-2.1.0.jar or in any other of the WildFly 8.1 standard modules.  I assume this means it is no longer supported.  This was a very nice quick way to make an EJB available to be managed through the JMX console.

      Is there an equivalent way to do this in WildFly 8.1?  I was unable to find any documentation related to it, so I was hoping someone here has good practical knowledge in that area.



        • 1. Re: Easiest way to register MBean with JBoss WildFly 8.1
          Flemming Harms Novice

          We had the exact same problem when we upgraded from JBoss AS 5 to Wildfly, and as you already found out this is not supported anymore


          The solution we come up with, was to write a small utility class that could registry mbeans, something like this


          public static void registerMBean(Object mBean, String simpleName) {
                  try {
                      final String mbeanName = "com.xxx.yyy:type=" + simpleName;
                      if (isApplicationMBeanRegistered(simpleName)) {
                          log.warn(String.format("MBean was already registered from the MBeanServer: %s. Unregistering it first.", mbeanName));
                      ManagementFactory.getPlatformMBeanServer().registerMBean(mBean, new ObjectName(mbeanName));
                      log.info(String.format("MBean registered to the MBeanServer: %s", mbeanName));
                  } catch (Exception e) {
                      throw new RuntimeException(e);



          - Flemming