Hi,
I'm having troubles with Hessian serialization.
JMX classes are standard, so they have fixed serialVersionUID, and sometimes they override readObject/writeObject to perform optimizations and custom serialization, to be compatible with older JMX version, and to allow interoperability with different implementations.
As an example, javax.management.ObjectName does not have any serializable field, nor in MX4J nor in JMXRI. As a result, Hessian does not serialize anything for it.
Furthermore, Hessian way to deserialize is to lookup a constructor with parameters and instantiate the object passing null for all arguments, and then setting the fields via reflection.
In JMX this always fails, as the specification requires (almost) always the arguments to be not null (otherwise an exception is thrown).
At the beginning I thought to write a serializer/deserializer pair for each JMX class: a loong long way :(
Then I decided to pass the java-serialized class as a byte[]. This involves writing only 1 serializer/deserializer pair. The side effect is that there is no interoperability with other languages, unless they implement java-serialization.
As a first implementation I can live with this limitation.
But then I discovered that Throwables are not deserialized correctly.
This is due to a probable bug in com.caucho.hessian.io.SerializerFactory: methods getSerializer(Class) and getDeserializer(Class) are not symmetric.
Throwables are treated in one way in one method, and forgotten in the second :(
I have put in place a simple workaround in MX4J code, but should be easy to fix it in Hessian code as well :)
Comments on the approach I've taken for JMX serialization are very welcome.
Regards,
Simon
Received on Fri 30 Jul 2004 06:40:09 -0700
This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:16:40 PDT