title: Problem with JMX query of Coherence node MBeans visible in JConsole
body: <p>I'm using JMX to build a custom tool for monitoring remote <a href="http://www.oracle.com/technology/products/coherence/" rel="nofollow noreferrer">Coherence</a> clusters at work. I'm able to connect just fine and query MBeans directly, and I've acquired nearly all the information I need. However, I've run into a snag when trying to query MBeans for specific caches within a cluster, which is where I can find stats about total number of gets/puts, average time for each, etc.</p>
  
  <p>The MBeans I'm trying to access programatically are visible when I connect to the remote process using JConsole, and have names like this:</p>
  
  <pre><code>Coherence:type=Cache,service=SequenceQueue,name=SEQ%GENERATOR,nodeId=1,tier=back
  </code></pre>
  
  <p>It would make it more flexible if I can dynamically grab all <code>type=Cache</code> MBeans for a particular node ID without specifying all the caches. I'm trying to query them like this:</p>
  
  <pre><code>QueryExp specifiedNodeId = Query.eq(Query.attr("nodeId"), Query.value(nodeId));
  QueryExp typeIsCache = Query.eq(Query.attr("type"), Query.value("Cache"));
  QueryExp cacheNodes = Query.and(specifiedNodeId, typeIsCache);
  ObjectName coherence = new ObjectName("Coherence:*");
  Set&lt;ObjectName&gt; cacheMBeans = mBeanServer.queryMBeans(coherence, cacheNodes);
  </code></pre>
  
  <p>However, regardless of whether I use <code>queryMBeans()</code> or <code>queryNames()</code>, the query returns a Set containing...</p>
  
  <ul>
  <li>...<strong>0 objects</strong> if I pass the arguments shown above</li>
  <li>...<strong>0 objects</strong> if I pass <code>null</code> for the first argument</li>
  <li>...all MBeans in the <code>Coherence:*</code> domain (112) if I pass <code>null</code> for the second argument</li>
  <li>...every single MBean (128) if I pass <code>null</code> for both arguments</li>
  </ul>
  
  <p><strong>The first two results are the unexpected ones</strong>, and suggest a problem in the <code>QueryExp</code> I'm passing, but I can't figure out what the problem is. I even tried just passing <code>typeIsCache</code> or <code>specifiedNodeId</code> for the second parameter (with either <code>coherence</code> or <code>null</code> as the first parameter) and I always get 0 results.</p>
  
  <p>I'm pretty green with JMX — any insight on what the problem is? (FYI, the monitoring tool will be run on Java 5, so things like JMX 2.0 won't help me at this point.)</p>