This content has been marked as final.
Show 1 reply
-
1. Re: Easiest way to register MBean with JBoss WildFly 8.1
fharms Apr 25, 2015 4:02 AM (in response to jeffreymetcalf)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)); unregisterMBean(simpleName); } 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); } }
Cheers,
- Flemming