I wound up abandoning Kyro, unfortunately. It doesn't seem to be able to
handle Google Guava immutable collections (see below), but Java
serialization handles them just fine.
I was able to fix my original problem by simply moving the "implements
Serializable" declaration up the chain in my custom classes, obviating
the requirement to have a default constructor in the base class in question.
Garret
On 9/22/2014 8:08 PM, Garret Wilson wrote:
On 9/22/2014 12:50 PM, Martin Grigorov wrote:
Not sure why but many others say "Kyro" instead of "Kryo", just like
you.
Haha! Thanks for pointing that out. Maybe I was getting hungry, and I
was thinking of "gyro". ;)
...
add dependency to org.wicketstuff.wicketstuff-serializer-kryo2:7.0.0-M3
and to com.esotericsoftware.kryo:kryo:LATEST_VERSION
I added org.wicketstuff.wicketstuff-serializer-kryo2:7.0.0-M3 but
skipped the direct kryo dependency for now, to see if I'd get a
decently recent version from the default distribution.
Unfortunately when I try to go back to a previous page version (to
test deserialization), I get the following:
Unexpected RuntimeException
Last cause: null
Stacktrace
Root cause:
java.lang.UnsupportedOperationException
at
com.google.common.collect.ImmutableCollection.add(ImmutableCollection.java:96)
at
com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:102)
at
com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:18)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:651)
(etc.)
From poring over the serialization trace, it turns out that I have a
custom model that keeps a reference to a certain object instance
(let's call it FooBar), and FooBar keeps a reference to a number of
classes. We happened to use ImmutableSet.copyOf(Class<?>...) to store
the set of classes. It looks like Kryo can't handle a Google Guava
immutable set. But that's what we use---it permeates our code. It's
really handy and efficient. Maybe I could extract this one single
reference and replace it with something else---but the issue is going
to crop up all over the place.
The interesting thing is that ImmutableCollection (the Google Guava
base class) actually implements Serializable. So have I traded one
problem for another?
Garret