Hi,

It is not necessary to use a different stream codec when you have control
over the class that is causing the error. You can annotate a different
field serializer instead, using the @FieldSerializer.Bind annotation. Here
is an example:

https://github.com/apache/apex-malhar/blob/2fe2903bfe65055c7fd361a97549b6e7e12d4289/library/src/main/java/org/apache/apex/malhar/lib/window/WindowOption.java#L50

It would be good to upgrade Kryo to 4.x in apex-core master. Would you like
to create a JIRA for it? (http://apex.apache.org/contributing.html)

Thanks,
Thomas





On Wed, May 16, 2018 at 10:31 AM, Aaron Bossert <aa...@punchcyber.com>
wrote:

> I am writing an application that includes a custom object.  One of the
> fields is of type Instant and seems to not agree with the version of Kryo
> that is used in Apex (see exception below).  I now that kryo 4.X supports
> serializing Instant fields, but for the life of me, cannot seem to find a
> way to either get Apex to use a newer version of Kryo.  Can anyone help?
> Perhaps setting a different streamcodec that uses the newer version of kryo
> would work, but I cannot seem to find an example of how to set a different
> streamcodec despite references to the two (Kryo and Java) that ship with
> Apex.
>
> ERROR com.datatorrent.stram.codec.DefaultStatefulStreamCodec -
> Catastrophic Error: Execution halted due to Kryo exception!
> com.esotericsoftware.kryo.KryoException: Class cannot be created (missing
> no-arg constructor): java.time.Instant
> Serialization trace:
> systemTime (com.punchcyber.streaming.pipeline.apex.datatypes.evtx.EvtxE
> vent)
> at com.esotericsoftware.kryo.Kryo$DefaultInstantiatorStrategy.n
> ewInstantiatorOf(Kryo.java:1228)
> at com.esotericsoftware.kryo.Kryo.newInstantiator(Kryo.java:1049)
> at com.esotericsoftware.kryo.Kryo.newInstance(Kryo.java:1058)
> at com.esotericsoftware.kryo.serializers.FieldSerializer.create
> (FieldSerializer.java:547)
> at com.esotericsoftware.kryo.serializers.FieldSerializer.read(
> FieldSerializer.java:523)
> at com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:730)
> at com.esotericsoftware.kryo.serializers.ObjectField.read(Objec
> tField.java:113)
> at com.esotericsoftware.kryo.serializers.FieldSerializer.read(
> FieldSerializer.java:528)
> at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:761)
> at com.datatorrent.stram.codec.DefaultStatefulStreamCodec.fromD
> ataStatePair(DefaultStatefulStreamCodec.java:98)
> at com.datatorrent.stram.stream.BufferServerSubscriber$BufferRe
> servoir.processPayload(BufferServerSubscriber.java:391)
> at com.datatorrent.stram.stream.BufferServerSubscriber$BufferRe
> servoir.sweep(BufferServerSubscriber.java:339)
> at com.datatorrent.stram.engine.GenericNode.run(GenericNode.java:269)
> at com.datatorrent.stram.engine.StreamingContainer$2.run(Stream
> ingContainer.java:1429)
>
>
> --
>
> M. Aaron Bossert
> (571) 242-4021
> Punch Cyber Analytics Group
>
>
>

Reply via email to