从Kafka主题消费时反序列化异常

时间:2018-01-16 09:45:34

标签: apache-kafka

在使用Kafka主题消息时,我反复收到以下异常。有人可以解释一下这个例外是什么意思以及如何避免它吗?

异常堆栈跟踪 -

 org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition TEST-TOPIC1.0-0 at offset 0. If needed, please seek past the record to continue consumption.
 Caused by: org.apache.kafka.common.errors.SerializationException: Error retrieving Avro schema for id 61
 Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Schema not found; error code: 40403
  at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:171)
  at io.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:188)
  at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:330)
  at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:323)
  at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:63)
  at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getBySubjectAndID(CachedSchemaRegistryClient.java:118)
  at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:121)
  at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:92)
  at io.confluent.kafka.serializers.KafkaAvroDeserializer.deserialize(KafkaAvroDeserializer.java:54)
  at org.apache.kafka.common.serialization.ExtendedDeserializer$Wrapper.deserialize(ExtendedDeserializer.java:65)
  at org.apache.kafka.common.serialization.ExtendedDeserializer$Wrapper.deserialize(ExtendedDeserializer.java:55)
  at org.apache.kafka.clients.consumer.internals.Fetcher.parseRecord(Fetcher.java:918)
  at org.apache.kafka.clients.consumer.internals.Fetcher.access$2600(Fetcher.java:93)
  at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.fetchRecords(Fetcher.java:1095)
  at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.access$1200(Fetcher.java:944)
  at org.apache.kafka.clients.consumer.internals.Fetcher.fetchRecords(Fetcher.java:567)
  at org.apache.kafka.clients.consumer.internals.Fetcher.fetchedRecords(Fetcher.java:528)
  at org.apache.kafka.clients.consumer.KafkaConsumer.pollOnce(KafkaConsumer.java:1086)
  at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1043)

1 个答案:

答案 0 :(得分:0)

在此处关注问题详情 https://github.com/confluentinc/schema-registry/issues/667

如果缺少avro架构,可以选择删除kafka和汇合数据文件夹来解决此问题