Kafka流订阅错误-无效版本

时间:2019-04-11 17:57:02

标签: java apache-kafka

当尝试通过Java Jetty微服务连接到主题时,出现此Kafka内部版本不匹配错误:

stream-thread [App-94d44dcd-f1d4-49a6-9dd3-8d4eee06f82a-StreamThread-1] Encountered the following error during processing:
java.lang.IllegalArgumentException: version must be between 1 and 3; was: 4
                at org.apache.kafka.streams.processor.internals.assignment.SubscriptionInfo.<init>(SubscriptionInfo.java:67)
                at org.apache.kafka.streams.processor.internals.StreamsPartitionAssignor.subscription(StreamsPartitionAssignor.java:312)
                at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.metadata(ConsumerCoordinator.java:176)
                at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.sendJoinGroupRequest(AbstractCoordinator.java:515)
                at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.initiateJoinGroup(AbstractCoordinator.java:466)
                at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.joinGroupIfNeeded(AbstractCoordinator.java:412)
                at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureActiveGroup(AbstractCoordinator.java:352)
                at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureActiveGroup(AbstractCoordinator.java:337)
                at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:333)
                at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1218)
                at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1175)
                at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1154)
                at org.apache.kafka.streams.processor.internals.StreamThread.pollRequests(StreamThread.java:861)
                at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:814)
                at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:767)
                at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:736)

关于什么可能导致此类异常的任何想法?

1 个答案:

答案 0 :(得分:0)

我自己遇到了此错误,很可能是因为您使用了非唯一的APPLICATION_ID_CONFIG和/或CLIENT_ID_CONFIG

// Give the Streams application a unique name.  The name must be unique in the Kafka cluster
// against which the application is run.
streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, "my-app");
streamsConfiguration.put(StreamsConfig.CLIENT_ID_CONFIG, "my-client");