Wednesday, 19 April 2017

java - Serial version id mismatch issue between server and client class




I am facing issues with serial version id mismatch.



My server is having code with serialVersionID=20150301L;

and myt client code is having diffrent so changed it manually but still facing the same issues.



Error:



java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.io.InvalidClassException: com.fedex.supplies.j2ee.common.client.reqresp.CustomerDataRequest; local class incompatible: stream classdesc serialVersionUID = 20150901L, local class serialVersionUID = -955959537118369236.


I tried option like implementing serilizable,manually defined serialVersionID same as server but getting the same error each time.


Answer



Try the following code




private static final long serialVersionUID = 20150901L;


if you don't make it private and static and final it will be ignored.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...