?
Solved

InvalidClassException

Posted on 2006-11-10
3
Medium Priority
?
239 Views
Last Modified: 2008-01-16
[11/10/06 20:04:32:165 CST]   23ed31 SessionContex E Exception is:
java.io.InvalidClassException:
com.hi.pc.ects.business.security.user.Administrator; Local class not
compatible: stream classdesc serialVersionUID=3407418462113710692 local class serialVersionUID=5638901064959335845
        at
java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:518)
        at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:562)
        at


When this came? what to do solve this?


0
Comment
Question by:Manish
3 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 100 total points
ID: 17919913
it happens when the classes are different when its serialized and deserialized.
You can add the following to resolve this:

private static final serialVersionUID = 5638901064959335845L; // define this, so that serilaizer wouldn't create a new one.
0
 
LVL 12

Assisted Solution

by:enachemc
enachemc earned 100 total points
ID: 17920549
You have two classes: you want to serialize a instance of a class and deserialize it into an instance of another class (this is what the JRE tells you). You probably think the classes are the same, but the JRE thinks not. This might happen if you did some modification to the class. If they are realy the same class, you should add the private static final serialVersionUID = 5638901064959335845L; definition (the number does not matter, as long as it is the same in the two classes).
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question