Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6319309

MXBean proxy for java.lang.management.ThreadMXBean gets NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 6
    • core-svc
    • None
    • b53
    • generic
    • generic

      The generic MXBean framework must be able to support the existing MXBeans from java.lang.management. But these MXBeans use null values in at least one place: the variou ThreadMXBean.getThreadInfo will return a null ThreadInfo if the input thread id does not exist. If you create an MXBean proxy using JMX.newMXBeanProxy and use it to call getThreadInfo, then a null returned ThreadInfo will get an exception in the proxy-handling code:
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
              at $Proxy0.getThreadInfo(Unknown Source)
              at ThreadMXBeanTest.main(ThreadMXBeanTest.java:30)
      Caused by: javax.management.MBeanException: interface java.lang.management.ThreadMXBean.getThreadInfo: cannot convert return value to open value: javax.management.openmbean.OpenDataException: Error calling getter for lockInfo: javax.management.openmbean.OpenDataException: Error calling getter for className: java.lang.NullPointerException
              at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175)
              at com.sun.jmx.mbeanserver.MXBeanSupport$MBeanDispatcher.invoke(MXBeanSupport.java:361)
              at com.sun.jmx.mbeanserver.MXBeanSupport.invoke(MXBeanSupport.java:239)
              at javax.management.StandardMBean.invoke(StandardMBean.java:475)
              at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:200)
              at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:183)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:865)
              at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:772)
              at com.sun.jmx.mbeanserver.MXBeanInvocationHandler$InvokeHandler.invoke(MXBeanInvocationHandler.java:152)
              at com.sun.jmx.mbeanserver.MXBeanInvocationHandler.invoke(MXBeanInvocationHandler.java:191)
              at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:311)
              ... 2 more
      Caused by: javax.management.openmbean.OpenDataException: Error calling getter for lockInfo: javax.management.openmbean.OpenDataException: Error calling getter for className: java.lang.NullPointerException
              at com.sun.jmx.mbeanserver.OpenConverter.openDataException(OpenConverter.java:1333)
              at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:775)
              at com.sun.jmx.mbeanserver.OpenConverter$ArrayConverter.toOpenValue(OpenConverter.java:512)
              at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:170)
              ... 12 more
      Caused by: javax.management.openmbean.OpenDataException: Error calling getter for className: java.lang.NullPointerException
              at com.sun.jmx.mbeanserver.OpenConverter.openDataException(OpenConverter.java:1333)
              at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:775)
              at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:773)
              ... 14 more
      Caused by: java.lang.NullPointerException
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:772)
              ... 15 more

            emcmanus Eamonn McManus
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: