1 Reply Latest reply on Oct 27, 2011 3:55 AM by ochaloup

    How to get the JBoss server instance id?

    mkuehle

      Is there a way to get the JBoss server instance id?

       

      On JBoss 4.x i could get it through a system property:

       

      String jBoss = System.getProperty("jboss.identity");

       

       

      On JBoss 5.x the way was through the remote identiy object:

      MBeanServer mBeanServer = MBeanServerFactory.createMBeanServer();

      Identity id = Id.get(mBeanServer);

      String instanceId = id.getInstanceId();

       

      But i don't find a way in JBoss 7 to receive the JBoss server instance id.

      Does someone know the right way to get the unique server instance id?

        • 1. Re: How to get the JBoss server instance id?
          ochaloup

          I'm not sure whether it's right way but maybe it could be possible to fetch it from a mBean.

          Whether I found correct one then it could be something like:

           

          ObjectName on = new ObjectName("JMImplementation:type=MBeanServerDelegate");

          Object attr = server.getAttribute(on, "MBeanServerId");