It's not a secret anymore!*
The moose likes Sockets and Internet Protocols and the fly likes java.net.SocketException: Connection reset due to serialVersionUID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java.net.SocketException: Connection reset due to serialVersionUID" Watch "java.net.SocketException: Connection reset due to serialVersionUID" New topic
Author

java.net.SocketException: Connection reset due to serialVersionUID

vikas byn
Ranch Hand

Joined: Mar 18, 2011
Posts: 80
I make client socket connection with serversocket and get ObjectInputStream and ObjectOutputStream , then I ObjectOutputStream.writeObject to send a object (without serialVersionUID) to the server, It works fine and if I send a object with serialVersionUID then it throw below exception on server side:
----------
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:185)
at java.net.SocketInputStream.read(SocketInputStream.java:199)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2265)
at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2445)
at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2515)
at java.io.ObjectInputStream$BlockDataInputStream.skipBlockData(ObjectInputStream.java:2417)
at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1913)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1598)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at net.one97.tm.controller.ActionInvoker.run(ActionInvoker.java:29)
at java.lang.Thread.run(Thread.java:636)

-------------

in both case - object implements Serializable interface.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

"Connection reset" means that the partner at the other end of the socket has disconnected unexpectedly. Perhaps it threw an exception and crashed because you sent it bad data? At any rate you would have to look at the details of what happens at the other end of the socket to find out for sure.
vikas byn
Ranch Hand

Joined: Mar 18, 2011
Posts: 80
Paul Clapham wrote:"Connection reset" means that the partner at the other end of the socket has disconnected unexpectedly. Perhaps it threw an exception and crashed because you sent it bad data? At any rate you would have to look at the details of what happens at the other end of the socket to find out for sure.


my server is working fine. problem occurred when i sent same object with serialVersionUID and that same object resides on both side server and client.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

Are you sure that both the server and the client have the same version of the class file?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
vikas byn
Ranch Hand

Joined: Mar 18, 2011
Posts: 80
Rob Spoor wrote:Are you sure that both the server and the client have the same version of the class file?

yes. both class have same serialVersionUID

for more information -

server and client are running on same PC that has OS- Linux RedHat and both are using same jdk 1.6.
vikas byn
Ranch Hand

Joined: Mar 18, 2011
Posts: 80
vikas byn wrote:
Rob Spoor wrote:Are you sure that both the server and the client have the same version of the class file?

yes. both class have same serialVersionUID

for more information -

server and client are running on same PC that has OS- Linux RedHat and both are using same jdk 1.6.


today it's working fine , i don't know why it generated error that day. thanks for reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.net.SocketException: Connection reset due to serialVersionUID