I am having an issue accessing an mbean using ObjectName expression matching. The following code successfully sets boolean b:
ObjectName objName =
new ObjectName("UnifiedSystem-search Cluster Control l-c:class=myclass");
boolean b = (boolean)myMBeanServer.invoke(objName, "areAlertsSuppressed");
The problem is that the mbeanname changes depending on coding environment. The name only changes slightly, however, which can easily be handled by the built-in expression matching that ObjectNames support. The following code (in the same environment as above) throws an InstanceNotFoundException:
ObjectName objName =
new ObjectName("UnifiedSystem-search Cluster Control *:class=myclass");
boolean b = (boolean)myMBeanServer.invoke(objName, "areAlertsSuppressed")
Any ideas how I can get the result I’m looking for?
As far as I know,
ObjectNamedoes not handle any wildcard patterns with theinvokemethod. You are going to have to use themyMBeanServer.queryNames(...)method to find the beans that match your pattern. Then you can callinvokewith the specific name.