【问题标题】:SerializationException: Error deserializing Avro message (StringIndexOutOfBoundsException)SerializationException:反序列化 Avro 消息时出错 (StringIndexOutOfBoundsException)
【发布时间】:2020-08-29 01:27:19
【问题描述】:

当 KafkaStream 尝试反序列化 Arvo 消息时,我遇到了这个错误:

[filtering-app-6adef284-11eb-48f8-8ca0-cde7da5224ab-StreamThread-1] ERROR org.apache.kafka.streams.KafkaStreams - stream-client [filtering-app-6adef284-11eb-48f8-8ca0-cde7da5224ab] All stream threads have died. The instance will be in error state and should be closed.
[filtering-app-6adef284-11eb-48f8-8ca0-cde7da5224ab-StreamThread-1] INFO org.apache.kafka.streams.processor.internals.StreamThread - stream-thread [filtering-app-6adef284-11eb-48f8-8ca0-cde7da5224ab-StreamThread-1] Shutdown complete
Exception in thread "filtering-app-6adef284-11eb-48f8-8ca0-cde7da5224ab-StreamThread-1" org.apache.kafka.streams.errors.StreamsException: Deserialization exception handler is set to fail upon a deserialization error. If you would rather have the streaming pipeline continue after a deserialization error, please set the default.deserialization.exception.handler appropriately.
    at org.apache.kafka.streams.processor.internals.RecordDeserializer.deserialize(RecordDeserializer.java:80)
    at org.apache.kafka.streams.processor.internals.RecordQueue.maybeUpdateTimestamp(RecordQueue.java:160)

原因异常是:

Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 1
Caused by: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1529)

Caused by: java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1
    at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
    at java.base/java.lang.String.substring(String.java:1874)

avro 配置很简单:

{
  "namespace": "io.confluent.developer.avro",
  "type": "record",
  "name": "Publication",
  "fields": [
    {"name": "name", "type": "string"},
    {"name": "title", "type": "string"}
  ]
}

来自本教程:https://kafka-tutorials.confluent.io/filter-a-stream-of-events/kstreams.html。生产者序列化输入字符串 "{"name": "George RR Martin", "title": "A Dream of Spring"}" 没有问题,但是基本上试图过滤事件的 KafkaStream 未能反序列化对象执行 Java 过滤逻辑...

以前有人遇到过这个问题吗?感谢任何建议!

【问题讨论】:

    标签: java apache-kafka avro apache-kafka-streams confluent-schema-registry


    【解决方案1】:

    发现问题:代理妨碍了。

    根本原因是应用无法连接到架构注册表。请在此处注明,以防以后有人遇到同样的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-26
      • 2019-08-05
      • 2020-05-03
      • 2022-06-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多