I have 2 classes: One that simulates a "server" and a second one. The idea is the server writes a file away with all the required data (usernames, psw, friends, etc...).
Basicly the check login and register user code is all located in the server class and works just fine.
But the problem occurs when i want to pass a List from the other class to the server class. In the server class this Lists also exists (for initializing (only once singleton)). This list is used to store all the info.
So the intention is adding the data from other the class to the server class. (adding in the existing list for example phonenumbers).
But then i get the error while trying to log in:
java.io.InvalidC开发者_运维技巧lassException: Implement.Server;
local class incompatible: stream classdesc serialVersionUID = ...
What could be the cause of such a error? Both classes implement Serializable.
First, read this. Next, make sure you explicitly set serialVersionUID on your serialized classes. Finally, make sure you change (increment) serialVersionUID when the structure of the class changes.
精彩评论