1、系统报错
[kafka-producer-network-thread | producer-1] [] [] ERROR org.apache.kafka.clients.producer.internals.Sender - [Producer clientId=producer-1] Aborting producer batches due to fatal error
org.apache.kafka.common.KafkaException: Unexpected error in InitProducerIdResponse; The server experienced an unexpected error when processing the request.
at org.apache.kafka.clients.producer.internals.TransactionManager$InitProducerIdHandler.handleResponse(TransactionManager.java:1390)
at org.apache.kafka.clients.producer.internals.TransactionManager$TxnRequestHandler.onComplete(TransactionManager.java:1294)
at org.apache.kafka.clients.ClientResponse.onComplete(ClientResponse.java:109)
at org.apache.kafka.clients.NetworkClient.completeResponses(NetworkClient.java:574)
at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:566)
at org.apache.kafka.clients.producer.internals.Sender.maybeSendAndPollTransactionalRequest(Sender.java:418)
at org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:316)
at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:243)
at java.lang.Thread.run(Thread.java:748)
[kafka-producer-network-thread | producer-1] [] [] ERROR o.s.kafka.support.LoggingProducerListener - Exception thrown when sending a message with key='null' and
2、排查与解决
出错原因:springboot集成spring-kafka的时候需要注意两者之间的版本对应关系,因为版本不兼容导致出现错误
解决:kafka-clients : 是springboot集成的spring-kafka,spring-kafka中引入了kafka-client的版本
参考:https://spring.io/projects/spring-kafka
参考:https://stackoverflow.com/questions/72402831/kafka-aborting-producer-batches-due-to-fatal-error