Hi, I would like to re-open this old thread because I have just been bitten by this kind of problem.
Before, I was using Hessian 3.0.13 but I recently upgraded to 3.1.1. I saw immediately that all classes for my transferred objects had to implement Serializable (which they didn't do before). No problem with that, I made them all implement Serializable. However, I have just got a problem that I cannot solve: a library is throwing an exception that includes a non-serializable member (this library is apache derby 10.2.2.0, the exception is derby own SqlException, the member is Sqlca). Since I embed this exception in my own exceptions transferred through hessian, I am stuck because I cannot change derby source code! For info, this bug in derby has been fixed on SVN but not in any official release. Since I don't want to impose users to build derby from the source, I have to find another way to workaround that issue. What I would really appreciate is that the new JavaSerializer behavior (ie checking that transferred objects implement Serializable) is an option that can be set/unset in some way. Else the only other work-around that I can think of (very ugly) is copy the current hessian JavaSerializer to my own one, remove the first lines of the constructor, and replace the hessian one by my own version (this without touching hessian jars because I don't want my users to use exclusively "official" OSS libs releases. Any comment on this? Cheers Jean-Francois -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Ferguson Sent: Tuesday, February 27, 2007 12:15 AM To: Ben Hood Cc: [email protected] Subject: Re: [Hessian-interest] Serializing collections - not implementingSerializable 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 ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
_______________________________________________ hessian-interest mailing list [email protected] http://maillist.caucho.com/mailman/listinfo/hessian-interest
