I am trying to monitor the objects of my application via JMX in JConsole. But in the JConsole i am not able to see the multiple objects of a same class. Here is my code:
ApplicationCache cache1 = new ApplicationCache();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("org.javalobby.tnt.jmx:type=ApplicationCacheMBean1");
mbs.registerMBean(cache1, name);
imitateActivity(cache1);
ApplicationCache cache2 = new ApplicationCache();
mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name2 = new ObjectName("org.javalobby.tnt.jmx:type=ApplicationCacheMBean2");
mbs.registerMBean(cache2, name2);
imitateActivity(cache2);
In the JConsole UI i am able to see the info of ApplicationCacheMBean1
only. There is no info about ApplicationCacheMBean2
. Please help.