I'm having trouble using serialization in Java. I searched the Internet for a solution but have not yet found an answer.
The problem is that I have a Java library (I have code, and I export it to the archive before the code runs), which I need to use with two different JVMs. One JVM is located on the server (Ubuntu, the JRE SE Java (TM) runtime is running (build 1.7.0_09-b05)), and the other is on Android 2.3.3. I compiled the library in Java 1.6.
Now I am trying to import to the client an object exported from the server, but I get this error:
java.io.InvalidClassException: [Lweka.classifiers.functions.MultilayerPerceptron $ NeuralEnd ;; Incompatible class (SUID): [Lweka.classifiers.functions.MultilayerPerceptron $ NeuralEnd ;: static final long long serialVersionUID = -359311387972759020L; but expected [Lweka.classifiers.functions.MultilayerPerceptron $ NeuralEnd ;: static final long serialVersionUID = 1920571045915494592L;
I have an explicit serial version UID declared in the MultilayerPerceptron$NeuralEnd , for example:
protected class NeuralEnd extends NeuralConnection { private static final long serialVersionUID = 7305185603191183338L; }
Where NeuralConnection implements the java.io.Serializable interface. If I execute serialver on MultilayerPerceptron$NeuralEnd , I get the serialVersionUID that I declared. So why did both JVMs change this value? Can you help me?
Thanks Alberto
source share