-3

Why am I getting this error?

Serialization Problem 
  java.io.InvalidClassException: scala.reflect.ClassTypeManifest; 
  local class incompatible: stream classdesc serialVersionUID =

using intellij

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
igx
  • 4,101
  • 11
  • 43
  • 88

2 Answers2

2

Let me guess: you serialized (through java's built-in serialization) a class that contains a ClassManifest (from whom ClassTypeManifest is a subtype) to a file (or database), then upgraded your scala version, and are now attempting to deserialize that file, right? Or you are sending a serialized object from one JVM process to another, and they run different versions of scala.

Well, don't do it. The first reason is that ClassTypeManifest declares no explicit serialVersionUID field (see What is a serialVersionUID and why should I use it?), which clearly indicates that any change to the class might change the serialization format. You cannot really expect any backward compatibility in ClassTypeManifest's serailized streams. In addition, in scala 2.10 ClassManifest is not even a class anymore: it's a mere alias to ClassTag which is a significantly different class.

So really, don't expect to be able to serialize (using java's serialization) a ClassManifest and read it back with another version of scala.

If you really need to do use java reflection, you might try to replace your ClassManifest fields with java.lang.Class fields (which are always safe to serialize/deserialize).

Otherwise, you could look into using other serialization libraries.

Community
  • 1
  • 1
Régis Jean-Gilles
  • 32,541
  • 5
  • 83
  • 97
0

I solved this. The solution was to use Maven lifecycle clean, and then install.

Yann Duran
  • 3,842
  • 1
  • 24
  • 24
igx
  • 4,101
  • 11
  • 43
  • 88