rabbitmq无法设置messageconverter 设置Jackson2JsonMessageConverter 就报错,问题解决。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageConverter' defined in class path resource [com/cyberbim/modbusdriver/config/MyAMQPconfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.support.converter.MessageConverter]: Factory method 'messageConverter' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
这个错误就是缺少了依赖
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.3</version>
</dependency>
加上这个就好了!
注意加上依赖版本可能和httpclient需求的版本有冲突调整和httpclient版本一致即可。
google第一次就搜出来了,结果不相信。一下午转回来还是这个问题。。。