Nullpointer Exception during Avro serialization

I am running into this strange situation. For my kafka streams app, the value deserializer is SpecificAvroSerializer and this one maps to one of the the Avro generated POJOs. This works fine when I send message to topic and streams is able to pick it up and deserialize it properly, am able to call POJO class methods to get values etc.

However further into the app, I have created a KGroupedStream and I am using this very same SpecificAvroSerde thus, and here it is throwing a nullpointer exception. Question is why, I am doing the exact same thing as the prev. step. Why is it complaining now.

final Serde<PoapproverSchema> valueSpecificAvroSerde = new SpecificAvroSerde<>();
KGroupedStream<String, PoapproverSchema> grouped = messages.groupBy(
(key, value) -> value.getInvoiceId().toString(),
Grouped.with(Serdes.String(),valueSpecificAvroSerde));

I think there was a mixup in classes. It was probably picking up an older version of this class. I create a brand new project and this problem went away.

1 Like