• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.net.SocketException: Connection reset due to serialVersionUID

 
vikas byn
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that both the server and the client have the same version of the class file?
 
vikas byn
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic