Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can deserialize a data #311

Open
rimeh-bennjima opened this issue May 15, 2018 · 3 comments
Open

How can deserialize a data #311

rimeh-bennjima opened this issue May 15, 2018 · 3 comments

Comments

@rimeh-bennjima
Copy link

rimeh-bennjima commented May 15, 2018

I use Kryo-sharded-4.0.1
I want to deserialize a data but I have an Exception when I write:
kryo.fromBytes(bytes)

com.esotericsoftware.kryo.KryoException: java.lang.IndexOutOfBoundsException: Index: 32, Size: 12 at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:144) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:543) at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:543) at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:543) at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:543) at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813) at com.twitter.chill.SerDeState.readClassAndObject(SerDeState.java:61) at com.twitter.chill.KryoPool.fromBytes(KryoPool.java:94)

@johnynek
Copy link
Collaborator

How was the data written? Looks like the data is not correct. Can you show a full failing example using KryoPool.toBytes()?

@rimeh-bennjima
Copy link
Author

rimeh-bennjima commented May 16, 2018

@johnynek An example of Data:
case class User(id: Int, cin: Int, details: UserDetails)

case class UserDetails(name: String, login: String, password: String, creationTime: LocalDateTime)

kryoPool.toBytesWithClass(User)

@johnynek
Copy link
Collaborator

User is the companion object not any instance of the class, not that it should matter.

LocalDateTime May give you a problem depending on how you set up the kryoPool.

Can you send a PR with a failing test so I can see the whole runnable example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants