On Feb 18, 2007, at 10:31 AM, Ben Hood wrote: > Hi, > > This is probably a newbie question but I couldn't google the solution. > > If I try to serialize a List<WhateverType> using the writeObject() > method in the HessianOutput class, it throws an IllegalStateException > complaining that my WhateverType should be serializable (I've attached > a stack trace at the bottom). > > By stepping through the code, it is apparent why this occurs, but I > find this a little bit counterintuitive - if Hessian defines the > binary encoding of arbitrary types, why do I need to use the Java > built in Serialization mechanism?
It's a validation issue. Initially, Hessian didn't require the Serializable, but if you have a bug where you forget to mark a field as transient (or similar), the resulting mess was very difficult to track down, mostly because the error would be caught much later at deserialization time. So, the little bit of hassle of marking classes as serializable is outweighed by the savings in debugging time if something does go wrong. -- Scott > > Surely this makes the List useless for cross-language purposes? > > Or am I missing the point here? > > Any help is appreciated, > > Ben > > ---------------------- > > java.lang.IllegalStateException: Serialized class > org.mule.providers.hessian.MySummable does not implement > java.io.Serializable > at com.caucho.hessian.io.JavaSerializer.<init>(JavaSerializer.java) > at com.caucho.hessian.io.SerializerFactory.getDefaultSerializer > (SerializerFactory.java:200) > at com.caucho.hessian.io.SerializerFactory.getSerializer > (SerializerFactory.java) > at com.caucho.hessian.io.HessianOutput.writeObject > (HessianOutput.java:315) > at com.caucho.hessian.io.CollectionSerializer.writeObject > (CollectionSerializer.java) > at com.caucho.hessian.io.HessianOutput.writeObject > (HessianOutput.java:317) > at com.caucho.hessian.io.HessianOutput.call(HessianOutput.java:131) > at com.caucho.hessian.client.HessianProxy.sendRequest > (HessianProxy.java:225) > at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java) > > > _______________________________________________ > hessian-interest mailing list > [email protected] > http://maillist.caucho.com/mailman/listinfo/hessian-interest _______________________________________________ hessian-interest mailing list [email protected] http://maillist.caucho.com/mailman/listinfo/hessian-interest
