Skip to content

Kafka Avro Classloading Issue in Quarkustest - SerializationException #7970

@bmgkp

Description

@bmgkp

Bug description

In testing trying to consume data for 2 different Avro schemata leads to an exception.


We are using

QuarkusCamel: 3.27.0

but got this bug also in 3.20.3

Currently we are using confluenct registry, using apicurio did not change the behavior.


Trying to consume data for 2 different Avro schemata leads to an exception:

org.apache.kafka.common.errors.SerializationException: Could not find class RestCallTrace specified in writer's schema whilst finding reader's schema for a SpecificRecord.

The Route is built up like:

		from("direct:kafka")
				.routeId("FromDirect")
				.process(Routes::transformToRestCallTraceOne)
				.to(getKafkaFirst())
				.process(Routes::transformToRestCallTraceTwo)
				.to(getKafkaSecond());

using 2 Kafka Topics and a total of 2 Avro Schemata involved. One Schema is used in a topic exclusively.

Tests are failing consuming data from the second kafka topic.


Seems that the

org.apache.avro.specific.SpecificData#classCache

in

org.apache.avro.specific.SpecificData#getClass

is filled using the wrong classloader while writing the data.

In following consuming cached entry is faulty and the consuming fails.


A reproducer is attached.

avro-reproducer.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions