spring集成kafka运行时报错:Failed to construct kafka producer] with root cause
org.apache.kafka.common.KafkaException: class org.apache.kafka.common.serialization.StringDeserializer is not an instance of org.apache.kafka.common.serialization.Serializer
如图:
解决方案,spring框架里面的kafka的消费者和生产者的key和value解析器用spring支持的,在application.properties配置spring支持的解析器:
spring.kafka.consumer.key-deserializer=org.springframework.kafka.support.serializer.StringOrBytesSerializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonSerializer
spring.kafka.producer.key-serializer=org.springframework.kafka.support.serializer.StringOrBytesSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://zhangphil.blog.csdn.net/article/details/123117699
内容来源于网络,如有侵权,请联系作者删除!