De-serializing multiple objects

Olivier ROLAND olivier.roland at laposte.net
Sat Jun 25 18:06:06 EDT 2011


> 
> I have a client that sends a Java serialized object to a server. The server
> then acknowledges this command and at a later date, when the command is
> complete, sends a done message.
> 
> The server uses raw sockets and a single ObjectOutputStream for the
> acknowledgement and the done, with a flush inbetween. 
> 
> I am not in a position to modify the server code.
> 
> I want to use Netty for the client code but am not sure on how to
> de-serialize the reply objects. If I use an ObjectDecoder I can de-serialize
> the first object (the acknowledgement) but the second object throws a
> StreamCorruptionException. Having google'd around a bit the best I can come
> up with is the server code should be closing or reseting the output streams
> between sending the reply messages. Is there anything I can do client side
> to overcome this - as I'm not able to change the server code.
> 
> I have tried using the CompatibleObjectDecoder and this works okay. However
> this doesn't seem to be a valid choice as this class is marked deprecated
> with warnings about random exceptions being thrown.
> 
> Any suggestions on how I could use Netty client side without modifying the
> server code?
> 
> Many thanks, 
> Martin
> 
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/De-serializing-multiple-objects-tp6515238p6515238.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
> 

According to this http://netty-forums-and-mailing-lists.685743.n2.nabble.com/StreamCorruptedException-when-using-CompatibleObjectDecoder-CompatibleObjectEncoder-tp2468712p2484482.html
You should find/write another "implementation" of ObjectInputStream that CompatibleObjectDecoder could use.
There are many problems with ObjectInputStream in the JDK so you could find "derived" ObjectInputStream in some projects.
That's weird. It will be interesting to check if this bug (if it really is I don't find the ticket) still occurs in JDK7.




More information about the netty-users mailing list