我是靠谱客的博主 现实小蚂蚁,最近开发中收集的这篇文章主要介绍kafka异常:Uncaught exception in kafka-producer-network-thread 异常:Kafka scheduler has not been started,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

版本: kafka_2.11-0.8.2.2
client:java-client
现象: kafka写入数据失败,没有异常信息.


kafka客户端生产者日志:
服务器一:
2016-04-25 10:53:31,764 ERROR org.apache.kafka.common.utils.KafkaThread: Uncaught exception in kafka-producer-network-thread | producer-2:
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
        at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:438)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:276)
        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)
        at java.lang.Thread.run(Thread.java:745)
2016-04-25 10:53:31,764 ERROR org.apache.kafka.common.utils.KafkaThread: Uncaught exception in kafka-producer-network-thread | producer-1:
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
        at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:438)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:276)
        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)
        at java.lang.Thread.run(Thread.java:745)
服务器二:
016-04-25 10:53:31,762 ERROR org.apache.kafka.common.utils.KafkaThread: Uncaught exception in kafka-producer-network-thread | producer-1:
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
        at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:438)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:276)
        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)
        at java.lang.Thread.run(Thread.java:745)
2016-04-25 10:53:31,762 ERROR org.apache.kafka.common.utils.KafkaThread: Uncaught exception in kafka-producer-network-thread | producer-2:
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
        at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:438)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:276)
        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)
        at java.lang.Thread.run(Thread.java:745)
        
分析:通过查找日志发现kafka日志里有一次报异常的信息.而且是两台服务器几乎同时报出来的错误.断定是kafka服务问题.




kafka服务器日志:
[2016-04-25 10:53:31,764] INFO [Kafka Request Handler on Broker 2], shutting down (kafka.server.KafkaRequestHandlerPool)
[2016-04-25 10:53:31,767] INFO [Kafka Request Handler on Broker 2], shut down completely (kafka.server.KafkaRequestHandlerPool)
[2016-04-25 10:53:31,976] INFO [Replica Manager on Broker 2]: Shut down (kafka.server.ReplicaManager)
[2016-04-25 10:53:31,977] INFO [ReplicaFetcherManager on broker 2] shutting down (kafka.server.ReplicaFetcherManager)
[2016-04-25 10:53:31,979] INFO [ReplicaFetcherManager on broker 2] shutdown completed (kafka.server.ReplicaFetcherManager)
[2016-04-25 10:53:31,989] INFO [Replica Manager on Broker 2]: Shut down completely (kafka.server.ReplicaManager)
[2016-04-25 10:53:31,990] INFO Shutting down. (kafka.log.LogManager)
[2016-04-25 10:53:32,014] INFO Shutdown complete. (kafka.log.LogManager)
[2016-04-25 10:53:32,016] WARN Kafka scheduler has not been started (kafka.utils.Utils$)
java.lang.IllegalStateException: Kafka scheduler has not been started
        at kafka.utils.KafkaScheduler.ensureStarted(KafkaScheduler.scala:114)
        at kafka.utils.KafkaScheduler.shutdown(KafkaScheduler.scala:86)
        at kafka.controller.KafkaController.onControllerResignation(KafkaController.scala:350)
        at kafka.controller.KafkaController.shutdown(KafkaController.scala:664)
        at kafka.server.KafkaServer$$anonfun$shutdown$8.apply$mcV$sp(KafkaServer.scala:285)
        at kafka.utils.Utils$.swallow(Utils.scala:172)
        at kafka.utils.Logging$class.swallowWarn(Logging.scala:92)
        at kafka.utils.Utils$.swallowWarn(Utils.scala:45)
        at kafka.utils.Logging$class.swallow(Logging.scala:94)
        at kafka.utils.Utils$.swallow(Utils.scala:45)
        at kafka.server.KafkaServer.shutdown(KafkaServer.scala:285)
        at kafka.server.KafkaServerStartable.shutdown(KafkaServerStartable.scala:42)
        at kafka.Kafka$$anon$1.run(Kafka.scala:42)
[2016-04-25 10:53:32,017] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)
[2016-04-25 10:53:32,020] INFO Session: 0x115138c6c4059b6e closed (org.apache.zookeeper.ZooKeeper)
[2016-04-25 10:53:32,020] INFO EventThread shut down (org.apache.zookeeper.ClientCnxn)
[2016-04-25 10:53:32,021] INFO [Kafka Server 2], shut down completed (kafka.server.KafkaServer)


分析:发现日志如上,时间恰好早于上面producer报错的时间.后来跟同事确认发现是由于一台kafka的brocker出现过重启,断定原因是重启导致的.




解决:
重启producer服务.

最后

以上就是现实小蚂蚁为你收集整理的kafka异常:Uncaught exception in kafka-producer-network-thread 异常:Kafka scheduler has not been started的全部内容,希望文章能够帮你解决kafka异常:Uncaught exception in kafka-producer-network-thread 异常:Kafka scheduler has not been started所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部