I am using Kryo for serialization / deserialization and not registering classes beforehand (I am working on that). That said, upon deserialization, I am getting the exception:
Unable to load class shell.api.model.BatteryStatuo with kryo's ClassLoader. Retrying with current..
Now, my classname is actually shell.api.model.BatteryStatus so I'm not sure what happened during serialization.
Is there a limitation on the length of the classname?
Also, as I am serializing JPA entities which have nested structures and likely have circular references, will that pose a potential issue? I would think I'd see a stack overflow exception if so.
This is a snippet of serializing an object:
protected final Kryo kryo = new Kryo();
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
try (final Output output = new Output(baos)) {
kryo.writeObject(output, data);
}
return (baos.toByteArray());
} catch (IOException e) {
LOGGER.error("error serializing", e);
throw (new RuntimeException("Error serializing", e));
}
deserialization:
try (final Input input = new Input(inputStream)) {
return ((Serializable) kryo.readObject(input, entityType));
}
entityType is the parent class, in this case: shell.api.model.Heartbeat
and, inside Heartbeat are several entities, one of which is BatteryStatus.