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

Issue with Kryo serialisation #84

Open
afaucogney opened this issue Sep 1, 2017 · 12 comments
Open

Issue with Kryo serialisation #84

afaucogney opened this issue Sep 1, 2017 · 12 comments

Comments

@afaucogney
Copy link

afaucogney commented Sep 1, 2017

I'm working on android project, with paper (with the rxpaper2 wrapper). I have some object data with Time members.

I saw in the Kryo code, that such serializer shoud be added by default if Java8 is enable. This is my case

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Here is the log :

E/dalvikvm: Could not find class 'sun.nio.ch.DirectBuffer', referenced from method com.esotericsoftware.kryo.util.UnsafeUtil.releaseBuffer
E/dalvikvm: Could not find class 'java.util.Optional', referenced from method com.esotericsoftware.kryo.serializers.OptionalSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.util.OptionalInt', referenced from method com.esotericsoftware.kryo.serializers.OptionalSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.util.OptionalLong', referenced from method com.esotericsoftware.kryo.serializers.OptionalSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.util.OptionalDouble', referenced from method com.esotericsoftware.kryo.serializers.OptionalSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.Duration', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.Instant', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.LocalDate', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.LocalTime', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.LocalDateTime', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.ZoneOffset', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.ZoneId', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.OffsetTime', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.OffsetDateTime', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.ZonedDateTime', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.Year', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.YearMonth', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.MonthDay', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers
E/dalvikvm: Could not find class 'java.time.Period', referenced from method com.esotericsoftware.kryo.serializers.TimeSerializers.addDefaultSerializers

How to solve this ?

How define a specific serializer as we do not get acces to kryo from paper (as far I read the doc)

@pilgr
Copy link
Owner

pilgr commented Sep 1, 2017

You can use Paper.addSerializer() to add custom serializers.

@pilgr pilgr closed this as completed Sep 1, 2017
@afaucogney
Copy link
Author

afaucogney commented Sep 4, 2017

@pilgr thanks for this, however, my issue is that Android does not hold such classes, and the serializer are added by default. So it triggers error. It seems to be more or less mapped to this Kryo issue EsotericSoftware/kryo#410

@afaucogney
Copy link
Author

@pilgr any comment or advice on this point ?

@pilgr
Copy link
Owner

pilgr commented Sep 11, 2017

Do you include Time class with third-party dependency?

@afaucogney
Copy link
Author

afaucogney commented Sep 15, 2017

@pilgr as far as I know the answer is no. I use JodaTime but that's different class as well as Date and Time classes from Android SDK
What is strange, is that Kryo add the serializers even if I do not have the class in the project.

I overide the kryo version to 4.0.1 to get that commit

EsotericSoftware/kryo@8fd3f89

Does I am the only one to get that bunch of exception ?

@afaucogney
Copy link
Author

@pilgr Please reopen the issue that I get visibiliy from community. thanks

@pilgr
Copy link
Owner

pilgr commented Sep 15, 2017

@afaucogney you're right, the fix should be to update Kryo dependency to version 4.0.1

@pilgr pilgr reopened this Sep 15, 2017
@afaucogney
Copy link
Author

@pilgr fact is that I forced the kryo dependency to be at 4.0.1 level, and nothing changed...

@pilgr
Copy link
Owner

pilgr commented Sep 16, 2017

@afaucogney could you write a test case or class or small project so I could reproduce the issue?

@pilgr
Copy link
Owner

pilgr commented Sep 22, 2017

@afaucogney could you check out with latest paper 2.5? Forcing kryo dependency might not work for your experiment because of transitive dependency caused by "de.javakaffee:kryo-serializers" lib.

@afaucogney
Copy link
Author

Previously I also force the kryo-serializers.
@pilgr I just updated paper to 2.5, from Android studio I have
kryo 4.0.1
serializer 0.42
paper 2.5
But I still get exceptions in the trace. Nothing really changed up to now.

@pilgr
Copy link
Owner

pilgr commented Sep 27, 2017 via email

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