1) regarding queryMBeans/queryNames:
====================================
the doc says:
----------------------------------------------------------------
For the queryMBeans method, the caller's permissions must imply MBeanPermission(mbeanServerName, null, null, name, "queryMBeans"). Additionally, for each MBean that matches name, if the caller's permissions do not imply MBeanPermission(mbeanServerName, className, null, name, "queryMBeans"), the MBean server will behave as if that MBean did not exist.
--- [snip] ---
For the queryNames method, the checks are the same as for queryMBeans except that "queryNames" is used instead of "queryMBeans" in the MBeanPermission objects. Note that a "queryMBeans" permission implies the corresponding "queryNames" permission.
----------------------------------------------------------------
In fact it should say that queryMBeans checks for:
MBeanPermission(mbeanServerName, null, null, null, "queryMBeans").
and not for
MBeanPermission(mbeanServerName, null, null, name, "queryMBeans").
2) regarding className
======================
The javadoc of MBeanServer says that the className used to check
permissions is always the value returned by getMBeanInfo().getClassName().
This is not true for "instantiate", where the classname is the classname
passed as parameter to instantiate (or createMBean, when the "instantiate"
permission is checked by "createMBean").