作者:-qone0_784 | 来源:互联网 | 2023-07-20 17:25
java.nio.channels.ClosedChannelExceptionatkafka.network.BlockingChannel.send(BlockingChann
java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:110)
at kafka.consumer.SimpleConsumer.liftedTree1$1(SimpleConsumer.scala:98)
at kafka.consumer.SimpleConsumer.kafka$consumer$SimpleConsumer
sendRequest(SimpleConsumer.scala:83)atkafka.consumer.SimpleConsumer.getOffsetsBefore(SimpleConsumer.scala:149)atkafka.consumer.SimpleConsumer.earliestOrLatestOffset(SimpleConsumer.scala:188)atkafka.consumer.ConsumerFetcherThread.handleOffsetOutOfRange(ConsumerFetcherThread.scala:84)atkafka.server.AbstractFetcherThread
anonfun$addPartitions$2.apply(AbstractFetcherThread.scala:187)
at kafka.server.AbstractFetcherThread
anonfun$addPartitions$2.apply(AbstractFetcherThread.scala:182)atscala.collection.TraversableLike$WithFilter
anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.immutable.Map$Map2.foreach(Map.scala:130)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at kafka.server.AbstractFetcherThread.addPartitions(AbstractFetcherThread.scala:182)
at kafka.server.AbstractFetcherManager
anonfun$addFetcherForPartitions$2.apply(AbstractFetcherManager.scala:88)atkafka.server.AbstractFetcherManager
anonfun$addFetcherForPartitions$2.apply(AbstractFetcherManager.scala:78)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:224)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:403)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at kafka.server.AbstractFetcherManager.addFetcherForPartitions(AbstractFetcherManager.scala:78)
at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:95)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
出现以上异常是由于服务器没有做kafka的主机名与ip的映射,
linux的目录是/etc/hosts
windows的目录是C:\Windows\System32\drivers\etc