SpringBoot中使用Kafka报错:Failed to construct kafka consumer
报错内容
在SpringBoot项目中使用了Kafka,在启动的过程中报错
2022-02-26 11:44:10.422 ERROR 26148 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka consumerat org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
Caused by: org.apache.kafka.common.KafkaException: org.apache.kafka.common.serialization.IntegerSerializer is not an instance of org.apache.kafka.common.serialization.Deserializerat org.apache.kafka.common.config.AbstractConfig.getConfiguredInstance(AbstractConfig.java:372) ~[kafka-clients-2.3.1.jar:na] at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:713) ~[kafka-clients-2.3.1.jar:na]... 27 common frames omitted
原因在报错中很清晰了,消费者反序列化使用的类错误
解决方案
把spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.IntegerSerializer
改为
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.IntegerDeserializer
就好了
SpringBoot中使用Kafka报错:Failed to construct kafka consumer相关推荐
- 【已解决】Springboot服务 Netty启动报错Failed to submit a listener
[已解决]Springboot服务 Netty启动报错Failed to submit a listener Force-closing a channel whose registration ta ...
- (错误)SpringBoot 中使用HikariPool 报错
SpringBoot在使用中发现报错,具体如下: 经过查资料是由于HikariPool 里的maxLifetime 设置不当导致的.一开始只是单纯的加大maxLifetime的链接.但是发现还不对,进 ...
- kafka报错Failed to find any class that implements Connector
在使用kafka的connect的功能时候遇到报错. 完整报错如下: [2020-09-11 11:14:53,612] ERROR Failed to create job for /home/ap ...
- SpringBoot中yml文件报错:org.yaml.snakeyaml.scanner.ScannerException:mapping values are not allowe here...
场景 SpringBoot中配置静态资源访问路径时提示: 报错代码如下: 实现 首先确保yml文件的格式要正确,每个冒号的后面要紧跟空格. 根据提示报错信息在static-path-pattern这个 ...
- 【Flink】Flink 写入 kafka 报错 Failed to send data to Kafka: Expiring 4 record(s) for 20001 ms has passed
文章目录 1.场景1 1.1 概述 1.2 百度 1.3 同样问题 2.场景再现 本文为博主九师兄(QQ:541711153 欢迎来探讨技术)原创文章,未经允许博主不允许转载. 1.场景1 1.1 概 ...
- 解决tomcat在pycharm中的初始化报错“ Failed to transfer file”“could not create folder”“(Permission denied)”
一.系统环境 客户端:Win10 1903:IDEA Ultimate 2020.1.3: 服务器:Ubuntu20:JDK1.8:Tomcat9.0.43 二.报错现象 运行Tomcat后,提示运行 ...
- SpringBoot 中使用HikariPool 报错Possibly consider using a shorter maxLifetime value.
SpringBoot 使用HikariPool遇到: HikariPool-1 - Failed to validate connection com.mysql.jdbc.JDBC4Connecti ...
- 【Flink】flink Kafka报错 : Failed to send data to Kafka: This server is not the leader for that topic-pa
1.背景 出现这个问题的背景请参考:[Kafka]Failed to send data to Kafka: Expiring 30 record(s) for xxx 732453 ms has p ...
- ubuntu中打开终端报错Failed to execute default Terminal Emulator
问题描述 在ubuntu中无法打开终端,提示未能执行默认终端,如下所示 可能原因 错误已经给出了提示,未能执行默认终端,更改默认项就可以了 问题解决 在settings中找到Preferred App ...
- 【Kafka】Flink kafka 报错 Failed to send data to Kafka: Failed to allocate memory within the config
1.背景 [2020-09-05 14:57:51] [INFO] [org.apache.flink
最新文章
- android开发重要控件,Android界面编程——Android基本控件
- c拆分字符串,并按照指定格式存入结构体数组
- OpenCV 玩九宫格数独(二):knn 数字识别
- Spring注解驱动开发
- SQL2012 之 创建备份计划
- Python实例 61,62
- Maven学习之(一)基本配置
- 从头开发一个 RPC 是种怎样的体验?
- SQLServer复制需要有实际的服务器名称才能连接到服务器,请指定实际的服务器名转...
- scrapy 中爬取时被重定向_Scrapy详解之scrapy shell
- 通过Visual C#创建一个Windows组件,然后把其接口以COM形式发布即可(转贴)
- 中文ocr-Benchmarking Chinese Text Recognition: Datasets, Baselines, andan Empirical Study
- 自动执行bash被拒绝 提示/bin/sh: /test.sh: Permission denied
- 在计算机上OF键开机键,电脑开机时出现英文字母串需要按回车键才能继
- oracle安装搜狗输入法教程,Ubuntu12.04安装搜狗拼音输入法
- hal库GPIO函数
- Python学习之绕圈圈题
- LeetCode 416分割等和子集
- spring boot 项目 事务 不能回滚 代理(not eligible for auto-proxying)
- 照片后期制作计算机配置,追求色彩真实还原,图片后期处理电脑配置推荐