Ramin Heidari
unread,May 30, 2012, 6:13:58 AM5/30/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to kryo-users
Hi,
I'm trying to serialize android intent and send it through socket to
server and deserialize it on the server by kryo but im getting
exception on server side during deserialization .I'd appritiate if you
help to know how i can fix it.
Server Side code :
Kryo kryo = new Kryo();
Input input = new Input(client.getInputStream());
Intent intent =new Intent();
intent = kryo.readObject(input, Intent.class);
input.close();
Client side code:
Output output = new Output(socket.getOutputStream());
Kryo kryo = new Kryo();
kryo.register(Intent.class);
Intent intent = new Intent(ClientActivity.this, MyService.class);
kryo.writeObject(output, intent);
output.close();
Exception :
05-30 10:08:30.894: W/System.err(8276):
com.esotericsoftware.kryo.KryoException: Class cannot be created
(missing no-arg constructor): android.content.ComponentName
05-30 10:08:30.894: W/System.err(8276): Serialization trace:
05-30 10:08:30.894: W/System.err(8276): mComponent
(android.content.Intent)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1001)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1013)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Serializer.create(Serializer.java:27)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:694)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:
229)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:614)
05-30 10:08:30.894: W/System.err(8276): at
com.myapp.socket.ServerActivity$ServerThread.run(ServerActivity.java:
167)
05-30 10:08:30.894: W/System.err(8276): at
java.lang.Thread.run(Thread.java:856)
05-30 10:08:30.894: W/System.err(8276):
com.esotericsoftware.kryo.KryoException: Class cannot be created
(missing no-arg constructor): android.content.ComponentName
05-30 10:08:30.894: W/System.err(8276): Serialization trace:
05-30 10:08:30.894: W/System.err(8276): mComponent
(android.content.Intent)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1001)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1013)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Serializer.create(Serializer.java:27)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:694)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:
229)
05-30 10:08:30.894: W/System.err(8276): at
com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:614)
05-30 10:08:30.894: W/System.err(8276): at
com.myapp.socket.ServerActivity$ServerThread.run(ServerActivity.java:
167)
05-30 10:08:30.894: W/System.err(8276): at
java.lang.Thread.run(Thread.java:856)