如何修复“ org.springframework.messaging.MessageHandlingException:消息处理程序中发生错误”?

时间:2019-06-18 08:55:46

标签: java maven docker apache-kafka jhipster

我有一个使用jhipster并使用kafka的Monolith应用程序。我遵循了这个tutorial

但是有这个问题:

Resolved [org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder$ProducerConfigurationMessageHandler@60776a72]; nested exception is org.apache.kafka.common.errors.SerializationException: Can't convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer, failedMessage=GenericMessage [payload=byte[43], headers={contentType=application/json, id=36f92cbf-b185-9e69-1d23-a1e3b0420e5a, timestamp=1560846532039}]]

我已经看到像this这样的不同问题,并且似乎应该纠正该问题。我在网上查找了所有内容。以下是我在pom.xml中添加的依赖项。

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-kafka</artifactId>
    </dependency>

通过连接到此网址http://localhost:8080/api/greetings/5

我应该看到消息。相反,我在此消息中遇到内部服务器错误[500]:

"error occurred in message handler [org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder$ProducerConfigurationMessageHandler@60776a72]; nested exception is org.apache.kafka.common.errors.SerializationException: Can't convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer

0 个答案:

没有答案