1 Reply Latest reply on Jul 14, 2004 3:09 PM by tomerbd

    An easier way to get attribute value of an mbean?

      Hi,

      Is there an easier way (I mean without the loop! I want to access the value directly...) to get the value of an attribute?

      (here is a code sample of what im using now...)

      InitialContext ctx = new InitialContext();
      ObjectName objectName = new ObjectName("chap2.ex1:service=JNDIMap");
      MBeanServer server = MBeanServerLocator.locateJBoss();
      MBeanInfo mBeanInfo = server.getMBeanInfo(objectName);
      MBeanAttributeInfo[] arrAttributeInfo = mBeanInfo.getAttributes();
      for(int a = 0; a < arrAttributeInfo.length; a ++)
      {
       AttrResultInfo attrResult = Server.getMBeanAttributeResultInfo("chap2.ex1:service=JNDIMap", arrAttributeInfo[a]);
       String attrValue = attrResult.getAsText();
       out.println(attrValue);
      }