JDK-6332962 : javax.managment.modelmbean.DescriptorSupport.writeObject() has problem validating serializability
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: core-svc
  • Sub-Component: javax.management
  • Priority: P2
  • Affected Version: 5.0u4
  • OS: windows_xp
  • CPU: other
  • Submit Date: 2005-10-05
  • Updated Date: 2017-05-16
  • Resolved Date: 2005-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other JDK 6
5.0u7Resolved 6 b63Resolved
javax.managment.modelmbean.DescriptorSupport.writeObject() has problem validating the
serializability of the descriptor field values.

This is causing a jmx remote client which runs over rmi/iiop to fail when invoking
getMBeanInfo on the MBeanServerConnection.
Windows XP
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
javax.managment.modelmbean.DescriptorSupport.writeObject() should validate
the referenced objects are serializable before writing out the serialized form
Note: We don't really have a standalone testcase for this as the problem was discovered with WAS 7.0 setup
but know that if javax.managment.modelmbean.DescriptorSupport.writeObject() is updated
as described the problem goes away.

SUGGESTED FIX Suggested fix is to remove the "targetObject" field from the HashMap that is included in the serial form of a DescriptorSupport. This can be done by making some small changes to the existing writeObject method.

EVALUATION It turns out that the underlying problem is with the targetObject field. This field can be used to direct an individual attribute or operation towards a different resource from the one defined for the Model MBean as a whole. As such, its value is often a non-serializable object, and in any case it does not make sense to serialize it. Therefore it would make sense to exclude it from the serialization of DescriptorSupport so that RequiredModelMBean.getMBeanInfo() returns a serializable object.

EVALUATION Nothing in the specification should lead anybody to suppose that a DescriptorSupport will be serializable if it contains a non-serializable object, any more than a HashMap is, for example. Furthermore there is no way in general to tell whether an object is serializable other than by serializing it. instanceof Serializable tells you nothing since (a) the object might have a writeObject that throws an exception (the recommended way for a subclass to be non-serializable if its parent is serializable), and (b) the object being serialized might itself be serializable but contain an object that is not, which indeed is exactly what we are seeing here with DescriptorSupport. It appears that the code that is failing here is incorrect and I do not see any clean way of allowing it to work anyway.

SUGGESTED FIX Fix suggested by the submitter: javax.managment.modelmbean.DescriptorSupport.writeObject() should validate the referenced object's are serializable before writing out the serialized form �� i.e. within the for loop prior to the line: ������ descriptor.put() line have: if (!(entry.getValue() instanceof java.io.Serializable)) continue;

WORK AROUND No workaround - other than not to use javax.management.modelmbean.DescriptorSupport with non-serializable objects