Niraj Niraj - 27 days ago 10
Java Question

Kafka Avro Deserialization Issue (java.lang.NoSuchMethodException: java.util.UUID.<init>(java.lang.String)

I am attempting to deserialize an Avro object from a Kafka stream and am seeing:

org.apache.avro.AvroRuntimeException: java.lang.NoSuchMethodException: java.util.UUID.<init>(java.lang.String)


Java UUID lacks a default empty constructor and so it seems like I need to write a custom deserializer. I wrote a new class that extended
Deserializer<UUID>
but when debugging I did not break into that class. I want to use this deserializer along with a generic deserializer (I figured this is possible because it is with Jackson).

Am I missing something simple that I need to do?

Answer

Turns out I just needed to write a custom Avro encoder!