Jackson1.9.6处理json报错 No serializer found for class org.hibernate.proxy.pojo.java

Jackson1.9.6处理json报错 No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistL

Jackson1.9.6 处理JSON报如下错的解决办法,org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) 

第一种解决办法

ObjectMapper mapper = new ObjectMapper();

mapper.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);(禁止SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS)

第二种解决办法

将要转化的持久类将上类级注解

@JsonIgnoreProperties( value={"hibernateLazyInitializer","handler"})

你可能感兴趣的:(json)