Kafka(0.9.0.0)提供ArrayIndexOutOfBoundsException

时间:2018-10-25 07:21:46

标签: apache-kafka kafka-producer-api

遵循的步骤:

cd /opt/kafka_2.11-0.9.0.0

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1  --partitions 1 --topic topic-test

bin/kafka-topics.sh --list --zookeeper localhost:2181

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic topic-test

发生时间:当您在生产者bash中写入任何内容时,此错误就会开始出现

已经尝试:从Zookeper Bash中删除主题并删除tmp位置中的主题日志

[2018-10-25 10:03:17,919] INFO [Kafka Server 0], started (kafka.server.KafkaServer)
[2018-10-25 10:03:18,080] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions [topic-test,0] (kafka.server.ReplicaFetcherManager)
[2018-10-25 10:03:18,099] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions [topic-test,0] (kafka.server.ReplicaFetcherManager)
[2018-10-25 10:03:48,864] ERROR Processor got uncaught exception. (kafka.network.Processor)
java.lang.ArrayIndexOutOfBoundsException: 18
    at org.apache.kafka.common.protocol.ApiKeys.forId(ApiKeys.java:68)
    at org.apache.kafka.common.requests.AbstractRequest.getRequest(AbstractRequest.java:39)
    at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:79)
    at kafka.network.Processor$$anonfun$run$11.apply(SocketServer.scala:426)
    at kafka.network.Processor$$anonfun$run$11.apply(SocketServer.scala:421)
    at scala.collection.Iterator$class.foreach(Iterator.scala:742)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    at kafka.network.Processor.run(SocketServer.scala:421)
    at java.lang.Thread.run(Thread.java:748)

如果将来有人提供解决此类其他错误的深刻见解,这将非常有帮助。

1 个答案:

答案 0 :(得分:0)

下载了最新的/kafka_2.11-2.0.0 并按照以下步骤操作:

bin/zookeeper-server-start.sh config/zookeeper.properties 
bin/kafka-server-start.sh config/server.properties 
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic topic-test 
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic topic-test 
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topic-test --from-beginning 

一切正常。 请注意-使用者脚本中的--bootstrap-server localhost:9092已更改