United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6495529 MBeans tab: NPE when handling Exception
JDK-6495529 : MBeans tab: NPE when handling Exception

Details
Type:
Bug
Submit Date:
2006-11-20
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
tools
OS:
windows_xp
Sub-Component:
jconsole
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
This bug is OS independend

EXTRA RELEVANT SYSTEM CONFIGURATION :
I am using mx4j as server with JSR-160 generic connector.

A DESCRIPTION OF THE PROBLEM :
If the jconsole catches an exception (ex) from invoking an MBean it does
ex = Utils.getActualException(ex)
This method checks if the type of the exception. E.g. if it is an MBeanException, it calls getTargetException on that exception. However in my case this is null.
Maybe this is a violation of the JMX spec but anyhows this happens in some cases with the latest mx4j using burlap or hessian as transport protocol.
One line later the jconsole performs a toString on "ex" causing a NullPointerException in my case. This NPE goes through the complete Thread and stalls the complete JConsole.
Please add a check if the "actual exception" is null and then use the original exception catched instead of null.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. start a JMX Server using mx4j together with hessian or burlap
2. connect with jconsole -J-Djava.endorsed.dirs=... service:jmx:hessian://...
3. invoke an operation that throws an MBean exception

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The jconsole should open a dialog displaying the exception message.
ACTUAL -
The JConsole dumps the strack-trace below (see Error Message) and the MBean tab panel (Attributes, Operations, Notifications, Info) keeps completely disabled no matter what MBean you select in the MBeans tree.


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Worker-MBeans-myhost:8080" java.lang.NullPointerException
at sun.tools.jconsole.inspector.XMBeanAttributes$AttributesListener$1.run(XMBeanAttributes.java:786)
at sun.tools.jconsole.Worker.run(Worker.java:37)
Exception in thread "Worker-MBeans-wep06132:8080" java.lang.NullPointerException
at sun.tools.jconsole.inspector.XMBeanAttributes$AttributesListener$1.run(XMBeanAttributes.java:786)
at sun.tools.jconsole.Worker.run(Worker.java:37)

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
If I use an Introspector in the mx4j Server and convert all Exceptions to e.g. RuntimeException with the orignal message, the exception is properly handled by jconsole.

                                    

Comments
EVALUATION

Check for non-null target exceptions before calling toString().
                                     
2006-11-20



Hardware and Software, Engineered to Work Together