java serialization problems with different JVMs
Posted
by
Alberto
on Stack Overflow
See other posts from Stack Overflow
or by Alberto
Published on 2012-11-09T15:18:25Z
Indexed on
2012/11/09
23:00 UTC
Read the original article
Hit count: 423
I am having trouble using serialization in Java. I've searched the web for a solution but haven't found an answer yet.
The problem is this - I have a Java library (I have the code and I export it to an archive prior to executing the code) which I need to use with two differents JVMs. One JVM is on the server (Ubuntu, running Java(TM) JRE SE Runtime Environment (build 1.7.0_09-b05)) and the other 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 receive this error:
java.io.InvalidClassException: [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;; Incompatible class (SUID): [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =-359311387972759020L; but expected [Lweka.classifiers.functions.MultilayerPerceptron$NeuralEnd;: static final long serialVersionUID =1920571045915494592L;
I do have an explicit serial version UID declared on the class MultilayerPerceptron$NeuralEnd
, like this:
protected class NeuralEnd extends NeuralConnection {
private static final long serialVersionUID = 7305185603191183338L;
}
Where NeuralConnection implements the java.io.Serializable interface. If I do a serialver on MultilayerPerceptron$NeuralEnd
I receive the serialVersionUID which I declared. So, why have both JVMs changed this value? Can you help me?
Thanks, Alberto
© Stack Overflow or respective owner