【RabbitMQ】反序列化失败 com.fasterxml.jackson.databind.exc.MismatchedInputException

记一次RabbitMQ,使用Jackson反序列化的报错;

报错:

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `[B` out of START_OBJECT token
 at [Source: (String)"{"id":1,"userName":"jack","name":"lili"}"; line: 1, column: 1]

先上代码:
RabbitMQ的配置类就不上了,基本配置

生产者:

消费者:

分析

还是没找到原因,主要应该是反序列化失败,我修改了监听端的参数,接收Message对象,手动getBody,就可以接收到数据;

有大佬知道的,请指正,感谢!

原文地址:https://www.cnblogs.com/mussessein/p/12106553.html

时间: 2024-08-01 00:53:55

【RabbitMQ】反序列化失败 com.fasterxml.jackson.databind.exc.MismatchedInputException的相关文章

JSON parse error: Cannot deserialize instance of `int` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc

代码程序: @PostMapping("selectById") @ResponseBody public Result selectById(@RequestBody int id) { Result result =new Result(); List<User> list = userService.selectById(id); if(list.size()==1){ result.setCode("000"); result.setMsg(&q

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field &quot;FileSize&quot;

请求阿里云的OSS接口图片信息,返回json格式的数据,通过ObjectMapper将json转为Image对象时候报错转换失败 将json转对象的代码: String jsonStr = "{\n" + " \"FileSize\": {\"value\": \"25929\"},\n" + " \"Format\": {\"value\": \"

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field &quot;ExceptionId&quot;

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ExceptionId" (class com.tongyan.ems.model.request.SynchronizedBean), not marked as ignorable (2 known properties: "cityIds", "exceptionId"]

error:com/fasterxml/jackson/databind/exc/InvalidDe

因为要给前端返回json数据,在pom文件中引入了jackson的包,启动项目的时候就一直报错 java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException.一开始以为是缺少jackson的jar包,看了一下,基本上都有.后上网查找资源普遍都说什么包冲突,去pom.xml文件查看了,有ali仓库的fastjson和另一个json包像似重叠,最后把另一删掉,还是报上面的问题

16. nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field &quot;auditUnitName&quot;

org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver:handleHttpMessageNotReadable:384 -Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unrecognized field

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class cn.edu.

详细信息   https://www.cnblogs.com/xuwenjin/p/8832522.html 解决办法: 在实体类上面加上注解 @JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" }) package cn.edu.aynu.Bean; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; im

jackson com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

jackson 2.2.2 由于vo中缺少json的某个字段属性引起 2种解决方法 1:vo中添加注解@JsonIgnoreProperties(ignoreUnknown = true) 2.  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

SpringBoot JPA懒加载异常 - com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy

问题与分析 某日忽然发现在用postman测试数据时报错如下: com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy [com.cbxsoftware.cbx.attachment.entity.RefAttachment#c109ec36e60c4a89a10eabc72416d984] - no Session (through reference chain: com.cbxsoftw

at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields异常

at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:666) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:156) at com.fasterxml.jackson.databind.ser.impl.IndexedListSe