title: How to access dynamicmbeans from a jmx client
body: <p>I am writing some test cases for the JMX interface in our product.  I can access attributes from standard MBeans (following <a href="http://java.sun.com/docs/books/tutorial/jmx/remote/custom.html" rel="nofollow noreferrer">sun tutorial</a>).  However, I don't seem to be able to access dynamic MBeans.  The attributes are fully (readable/writable) from JConsole.</p>
  
  <pre><code>JMXConnector jmxc = getJMXConnector();  // Takes care of our connection
  MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
  
  ObjectName mbeanName = new ObjectName("com.xyz.prodname:type=LogManager");
  
  // Up to this point, the logic is the same as the working logic.  In our working logic,
  // DynamicMBean is replace with our MBean interface class.
  DynamicMBean mbean = (DynamicMBean)JMX.newMBeanProxy(mbsc, mbeanName, DynamicMBean.class);
  Object o = mbean.getAttribute("AttributeNameAsItAppearsInJConsole"); 
  </code></pre>
  
  <p>o should be a Boolean, but it is null.  No exceptions are thrown.</p>
  
  <p>I have also tried a few other permutations on the attribute name, but I believe it should be the simple name as I've defined it in the implementation class.</p>