2

I have three projects. First one is RMI CLient and second one is RMI Server. I also have third project where I have some common class. I made library from third project and add into others (Client and Server). I have problem when i want to pass some class A which is in library (third project) as an argument of remote class. My problem is that i get exception about serialVersionUID... where is the problem ? I think that the problem is in shering this class A between Client and Server.

please help

  • 1
    Paste the code, and the complete exception stack trace. But you probably simply have two different versions of the library in the client and server. – JB Nizet Feb 23 '13 at 14:57

2 Answers2

1

Did you set a serialVersionUID in your classes?

If not the serializer could think that you're trying to deserialize an incompatible versions of the same class. That's because the serialVersionUID will be generated and might differ on different platforms.


See this Fíndbugs Pattern, to learn why you should define one: http://findbugs.sourceforge.net/bugDescriptions.html#SE_NO_SERIALVERSIONID

Also have a look at this question What is a serialVersionUID and why should I use it?

Community
  • 1
  • 1
Christian Strempfer
  • 7,291
  • 6
  • 50
  • 75
0

It seems that you are using different implementations for one class in your first and second projects. Since you said the class A is in a shared library, now you should check the fields that are used in that class, and make sure all of the classes related to them are shared (if you are passing instances from their subclasses, you should check those subclasses too).

Hassan
  • 396
  • 5
  • 12