local class incompatible: stream classdesc serialVersionUID = -4312319268131871162, local class serialVersionUID = -5312119737527277188

    By W.ZH  Aug 2014

Issue:

When we use some webservice , we get error like this :

java.io.InvalidClassException: com.abc.EmailInfo; local class incompatible: stream classdesc serialVersionUID = -4312319268131871162, local class serialVersionUID = -5312119737527277188

com.abc.EmailInfo is a java object is used in some code.

 

 

Reason:

com.abc.EmailInfo exist in fact in several jar files. each jaf file in fact contain a different version of the  EmailInfo  class, even class source code could lokks like same.

 

What we should do is:

1. find out all the jar files that contain this class file:  j1.jar and j2.jar such as.

2. use serialver to check the serialVersionUID of each class in each jar:

       C:\SVN\….WEB-INF\lib>serialver -classpath jar1.jar com.abc.EmailInfo

        com.abc.EmailInfo:    static final long serialVersionUID = -5312119737527277188L;

    

       C:\SVN\….WEB-INF\lib>serialver -classpath jar2.jar com.abc.EmailInfo

        com.abc.EmailInfo:    static final long serialVersionUID = -4312319268131871162L;

3. now you see the reason of the class with same name of diff version in fact will creat different serialVersionUID

4. so try to unzip one of jar file and then get class to update the other one, suppose the have same code for EmailInfo class, so they can exchange with each other.

5. use this command to update the class in one jar file:

C:\SVN\….WEB-INF\lib>jar uf jar1.jar com\abc\EmailInfo.class

Then you can try to see result.

Advertisements