"Method not supported on an outbound message" error when retrieving schema during deserialization
Closed this issue · 3 comments
Hello,
I was trying to make the debezium connector work with apicurio and had an error that I managed to reproduce cloning the demo project.
After launching the SimpleAvroConsumerApp, I have the following error (exactly the same with debezium):
Exception in thread "main" org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition SimpleAvroAppTopic-0 at offset 0. If needed, please seek past the record to continue consumption.
Caused by: java.lang.IllegalStateException: Method not supported on an outbound message.
at org.glassfish.jersey.message.internal.OutboundJaxrsResponse.readEntity(OutboundJaxrsResponse.java:144)
at io.apicurio.registry.utils.serde.AvroKafkaDeserializer.toSchema(AvroKafkaDeserializer.java:75)
at io.apicurio.registry.utils.serde.AvroKafkaDeserializer.toSchema(AvroKafkaDeserializer.java:39)
at io.apicurio.registry.utils.serde.AbstractKafkaDeserializer$1.toSchema(AbstractKafkaDeserializer.java:44)
at io.apicurio.registry.utils.serde.SchemaCache.lambda$getSchema$0(SchemaCache.java:52)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at io.apicurio.registry.utils.serde.SchemaCache.getSchema(SchemaCache.java:40)
at io.apicurio.registry.utils.serde.AbstractKafkaDeserializer.deserialize(AbstractKafkaDeserializer.java:74)
The point is : why is it read as an outbound message and not an inbound?
This is a problem with the Jersey implementation of the jax-rs rest client. New versions of Apicurio Registry no longer use a generated jax-rs rest client for reasons like this. But the latest release version still does have this issue. You can solve it by adding RESTEasy jax-rs to your project's classpath to use that instead of jersey.
Oh, and to answer your question - the error is happening when the kafka application is communicating with the Apicurio Registry API (to fetch the schema), which is why the error indicates a problem on the outbound message - it's actually failing trying to send a REST request to the registry.
Thanks for the answer Eric. I'll do so :)