I an storing in Ignite cache an object that contains a field of type org.joda.time.chrono.ISOChronology
.
The ISOChronology
is a 3rd party class having writeReplace()
and readResolve()
methods.
The cache is using the binary format, i.e. IgniteCache.withKeepBinary()
and uses an EntityProcessor
. The object is initially serialized using BinaryObjectBuilder
on client side and passed as an argument to the processor. Processor receives the BinaryObject
, calls toBuilder()
and modifies some fields. The ISOChronology
field is not modified. Then, BinaryObjectBuilder.build()
is called to serialize the modified value and fails. For some reason, it tries deserializing ISOChronology
before serializing it again, and this class is not available on the server.
The error is:
org.apache.ignite.binary.BinaryObjectException: Failed to unmarshal object with optimized marshaller
Why does BinaryObjectBuilder
deserializes a BinaryObject
before serializing it again ? There is a warning in documentation about the fact that Externalizable
objects are deserialized, it seems related:
https://ignite.apache.org/docs/latest/key-value-api/binary-objects#enabling-binary-mode-for-caches
Still, not sure why this is done and how to avoid it. Any insights ?
Expected:
Calling BinaryObjectBuilder.build()
with field containing BinaryObject
is expected to succeed without deserializing the field.
Actual:
The operation fails trying to deserialize ISOChronology
value.