2 Replies Latest reply on Jan 17, 2007 5:50 AM by michele curioni

    find mbean server - example of code not JBoss specific.

    michele curioni Newbie

      Hi all,

      I discovered that in the JVM that runs Jboss there can be more than one instances of MBeanServer.
      This creates a problem when the code doesn't use JBoss specific classes to look up on of these instances.

      If I use the following code I can get more than one instance back:

      List list = MBeanServerFactory.findMBeanServer(null);
      if (!list.isEmpty()) {
      MBeanServer server = (MBeanServer) list.iterator().next();
      ....
      }

      Say that I run this code inside JBoss, I want my code to use JBoss own MBeanServer.
      How to do that, and keep the code vendor agnostic?

      Thanks,
      Michele