I have reached my conclusion:  I don't know what I am doing.  :-(

I now realize that the query expression will filter MBeans based on the values 
of the properties defined for the MBean.  I mistakenly thought that parts of 
the MBean name were the attributes that I could query on.  That is, an MBean 
with name "foo.bar:name1=xxx,name2=yyy" had attributes name1 and name2 and thus 
I could query on those.  But actually, if this MBean has properties prop1 and 
prop2, I can use a query to find an MBean with particular values for properties 
prop1 or prop2.  The tutorials that were confusing to me at first are now a lot 
clearer.

But, I still have room to complain. :-)

First, class org.jboss.mx.server.MBeanServerImpl, method queryMBean has this 
code:

try
  | {
  |    return queryExp.apply(objectName);
  | }
  | catch (Exception e)
  | {
  |    return false;
  | }

Not quite sure who thought it was a good idea to throw away the exception.  So, 
I added a logging statement to the code to find out what exception was being 
thrown and noticed this exception:
  | 
  | Exception in thread "main" java.lang.NullPointerException
  |         at 
javax.management.BadAttributeValueExpException.toString(BadAttributeValueExpException.java:71)
  |         at 
org.apache.log4j.spi.VectorWriter.println(ThrowableInformation.java:88)
  | . . .

OK, so printing of the stack trace blew up.  Seems to be "a bad thing" to me.  
Looking at the above toString method, I see:

return "Bad attribute value expression: " + val.toString();

Hmm, not only is the call to toString on variable val superfluous, but it is 
also a bad idea because if val is nul? (you get the idea).  OK, so get rid of 
the toString call on val so that I can finally get my exception printed out.  
And I then found another instance where an exception was being thrown away in 
javax.management.AttributeValueExp.getAttribute:

try
  | {
  |   MBeanServer mbs = QueryEval.getMBeanServer();
  |   return QueryEval.getMBeanServer().getAttribute(name, attr);
  | }
  | catch (Exception e)
  | {
  |   return null;
  | }

The toString bug should be fixed.  Should I write a JIRA?

For the dropped exceptions, I thought it would be nice to at least log them.  
But, given the way the code is written, every query will generate a lot of 
exceptions because if you query for a particular property, an exception is 
thrown for every MBEan that doesn't have such a property. But this could be 
handled by catching something other than Exception.  Not sure if this is worth 
opening a JIRA or not.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3942338#3942338

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3942338


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to