Sep 15th, 2008, 08:56 AM
wildcards with ObjectName
I'm trying to set an ObjectName with wildcard *.
In javadoc 1.5 I see the following exapmles:
*:type=Foo,name=Bar to match names in any domain whose exact set of keys is type=Foo,name=Bar.
d:type=Foo,name=Bar,* to match names in the domain d that have the keys type=Foo,name=Bar plus zero or more other keys.
*:type=Foo,name=Bar,* to match names in any domain that has the keys type=Foo,name=Bar plus zero or more other keys.
d:type=F?o,name=Bar will match e.g. d:type=Foo,name=Bar and d:type=Fro,name=Bar.
d:type=F*o,name=Bar will match e.g. d:type=Fo,name=Bar and d:type=Frodo,name=Bar.
d:type=Foo,name="B*" will match e.g. d:type=Foo,name="Bling". Wildcards are recognized even inside quotes, and like other special characters can be escaped with \.
but wen I try to do this on my own: jboss.j2ee:jndiName=ValidatorMDB*,service=EJB
I receive the following ecxeption: javax.ement.MalformedObjectNameException: Invalid character '*' in value part of property
does someone knows what am I doing wrong
Sep 15th, 2008, 10:47 PM
Use Wildcards for Querying ObjectNames
You want to use the wildcard symbol (*) for querying MBeans with similar ObjectNames. This allows you to obtain a handle to multiple MBeans, but is not meant for the actual naming of a particular MBean. In fact, if you named an MBean with an ObjectName that included the asterisk, then it would be ambiguous what was meant when an asterisk was used in an MBean query. This is why a MalformedObjectNameException is thrown when you attempt to name a particular MBean with an ObjectName that includes a wildcard (pattern).