3 Replies Latest reply on Jun 15, 2003 9:22 PM by Peter Callies

    MBeanServer.queryNames() not working

    Peter Callies Newbie

      If it's user error, I hope someone can point it out to me. I'm using version 3.0.6. I have one MBean that is attempting to use MBeanServer.queryNames() to look up other MBeans. However, queryNames() is returning an empty Set.

      Here's the code:
      QueryExp nameExp =
      Query.match(Query.attr("name"), Query.value("XTFResource"));
      QueryExp exp = nameExp;
      ObjectName scope = new ObjectName("tsh:*");
      logger.debug("Query expression="+ exp);
      logger.debug("Scope="+ scope);

      ArrayList mbeanServers = MBeanServerFactory.findMBeanServer(null);
      Iterator iter = mbeanServers.iterator();
      while (iter.hasNext()) {
      MBeanServer mbeanServer = (MBeanServer) iter.next();
      Set names = mbeanServer.queryNames(scope, exp);
      logger.debug("Found XTFResources: " + names);

      The logging output is:
      Query expression=(name matches XTFResource)
      Scope=tsh:*

      When I ran the method, the following MBean was registered, but queryNames did not return it.
      Domain Name: tsh name: XTFResource