---
title: "Caused by: org.codehaus.jackson.map.JsonMappingException"
author: "iblike"
date: "2011-08-29T16:09:57Z"
tags: []
categories: ["编程语言"]
slug: "caused-by-org-codehaus-jackson-map-jsonmappingexception"
draft: false
lastmod: "2011-08-29T16:09:57Z"
id: 1160576
url: "https://iblike.iteye.com/blog/1160576"
---

写道

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) ) (through reference chain: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\_$$\_javassist\_15\["hibernateLazyInitializer"])

后来google发现在je上有人有类似的问题：http://147175882.iteye.com/blog/380823

 

147175882 写道

分析原因,是因为jsonplugin用的是java的内审机制.hibernate会给被管理的pojo加入一个hibernateLazyInitializer属性,jsonplugin会把hibernateLazyInitializer也拿出来操作,并读取里面一个不能被反射操作的属性就产生了这个异常.

 

 

不过我用的是jackson来转json，所以想到了用annotation来排除hibernateLazyInitializer 这个属性

在你的pojo类声明加上：

 

@JsonIgnoreProperties(value={"hibernateLazyInitializer"})  

```
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})
```

 

既可以