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;

import java.io.Serializable;
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class Book implements Serializable {
    private String  bookName;
    private String author;

    public Book(){
    }

    public Book(String bookName, String author) {
        this.bookName = bookName;
        this.author = author;
    }
}

原文地址:https://www.cnblogs.com/zhulina-917/p/10557487.html

时间: 2024-08-30 01:25:59

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class cn.edu.的相关文章

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包像似重叠,最后把另一删掉,还是报上面的问题

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ExceptionId"

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"]

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "FileSize"

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

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

【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","

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

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

【jackson 异常】com.fasterxml.jackson.databind.JsonMappingException异常处理

项目中,父层是Gene.java[基因实体]  子层是Corlib.java[文集库实体],一种基因对用多个文集库文章 但是在查询文集库这个实体的时候报错:[com.fasterxml.jackson.databind.JsonMappingException] 1 com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassis