Title: MBeanServer.queryNames() not working
The "name" attribute should be "Name" to match the standard mbean naming convention.
 
xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
Sent: Tuesday, June 10, 2003 7:01 AM
Subject: [JBoss-user] MBeanServer.queryNames() not working

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


Reply via email to