I have an Android client and a Google App Engine Servlet.
And I am transferring objects from client to server by serialization.
Serialization works fine for all the serialized Object in my project,
except to The Entity Object called Profile that I am saving in my JPA DB.
now when I am transferring Profile instance from client to server it works fine
but when I transfer from server to client i get the exception as written below.
I'll add that i don't have code duplication in my code.
Profile class is in Server Project, and Client project contains Server's path.
W/System.err(1104): java.io.InvalidClassException: javax.jdo.identity.LongIdentity; Incompatible class (SUID): javax.jdo.identity.LongIdentity: static final long serialVersionUID =2472141538875317527L; but expected javax.jdo.identity.LongIdentity: static final long serialVersionUID =2940818939440220368L;
My Enity class is:
@Entity
public class Profile implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private int age;
private String email;
private boolean onlineStatus = false;
public Profile() {}
public Profile(int age,String email)
{
super();
this.age = age;
this.email = email;
}
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public boolean isOnlineStatus()
{
return onlineStatus;
}
public void setOnlineStatus(boolean onlineStatus)
{
this.onlineStatus = onlineStatus;
}
full stack trace:
04-21 21:04:56.577: W/System.err(1104): at java.io.ObjectInputStream.verifyAndInit(ObjectInputStream.java:2697)
04-21 21:04:56.577: W/System.err(1104): at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1825)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:811)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2039)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:916)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2262)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2217)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readNewArray(ObjectInputStream.java:1678)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:914)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2262)
04-21 21:04:56.592: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2217)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1291)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:518)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1535)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1443)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2112)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:916)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2262)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2217)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readNewArray(ObjectInputStream.java:1678)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:914)
04-21 21:04:56.597: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2262)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2217)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readFieldValues(ObjectInputStream.java:1291)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:518)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1535)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1443)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2112)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:916)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2262)
04-21 21:04:56.607: W/System.err(1104): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2217)
04-21 21:04:56.607: W/System.err(1104): at streetMeet.Client.CustomHttpClient.readObject(CustomHttpClient.java:274)
04-21 21:04:56.607: W/System.err(1104): at streetMeet.Client.CustomHttpClient.executeHttpPost(CustomHttpClient.java:59)
04-21 21:04:56.607: W/System.err(1104): at streetMeet.Client.StreetMeetActivity.connectToServer(StreetMeetActivity.java:154)
04-21 21:04:56.607: W/System.err(1104): at streetMeet.Client.StreetMeetActivity.sendMessageToServer(StreetMeetActivity.java:141)
04-21 21:04:56.607: W/System.err(1104): at map.StreetMapActivity$1.run(StreetMapActivity.java:116)
No comments:
Post a Comment