2 Replies Latest reply on Jul 7, 2010 1:33 PM by emcmanus-JavaNet

    How to use queryNames()

      can anybody tell me how to use queryNames() in MBeanServerConnection Interface
        • 1. Re: How to use queryNames()
          I have written a code like this......but iam unable to get the MBean names.......

          ObjectName name = new ObjectName("*:*");
          ObjectName filter = new ObjectName("*:*");
          Set names = server.queryNames(name,filter);
          String[] array = (String[])set.toArray(new String[set.size()]);
          for(int i=0;i<array.length;i++)
          • 2. Re: How to use queryNames()

            If that is really the code you are using then the problem is that your Set is sometimes called "names" and sometimes "set". Other than that the code seems correct, although server.queryNames(null, null) would work just as well as the explicit values you have provided.

            Éamonn McManus -- JMX Spec Lead -- [http://weblogs.java.net/blog/emcmanus]