Hi everyone,
I have managed to publish StatisticsService with JBoss using
MBeanServer mbeanServer =
ManagementFactory.getPlatformMBeanServer();
ObjectName on =
new ObjectName("Hibernate:type=statistics,application=sample");
StatisticsService mBean = new StatisticsService(); mBean.setSessionFactory(HibernateSession.instance().getSessionFactory());
mbeanServer.registerMBean(mBean, on);
However, when I use MX4J, all my other MBeans show up fine, except for StatisticsService. This is very baffling because StatisticsService uses the same method to publish its data as does one of my own MBeans which works fine. I use a RMI adaptor for MX4J, and use it like this:
MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
LocateRegistry.createRegistry(44334);
JMXServiceURL url = new
JMXServiceURL ("service:jmx:rmi://localhost:2004/jndi/rmi://192.168.43.75:44334/gmlc");
(JMXConnectorServerFactory.newJMXConnectorServer(url,null, mbeanServer)).start();
|