user2963481 user2963481 - 2 years ago 656
JSON Question

No serializer found for class org.hibernate.proxy.pojo.javassist.Javassist?

I am working on

but I am getting this error.

HTTP Status 500 - Could not write JSON: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.SerializationFeature.FAIL_ON_EMPTY_BEANS) )

Please check my Entity below

public class User {

private Integer userId;

private String firstName;

private String lastName;

private String middleName;

private String emailId;

private Integer phoneNo;

private String password;

private String confPassword;

private String token;

private Date createdOn;

@Fetch(value = FetchMode.SUBSELECT)
@JoinTable(name = "USER_ROLES", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
private List<ActifioRoles> userRole = new ArrayList<ActifioRoles>();

@Fetch(value = FetchMode.SUBSELECT)
private List<com.actifio.domain.Address> userAddress = new ArrayList<com.actifio.domain.Address>();

private Tenant tenantDetails;

public Integer getUserId() {
return userId;
public void setUserId(Integer userId) {
this.userId = userId;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmailId() {
return emailId;
public void setEmailId(String emailId) {
this.emailId = emailId;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String getConfPassword() {
return confPassword;
public void setConfPassword(String confPassword) {
this.confPassword = confPassword;
public Date getCreatedOn() {
return createdOn;
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;

public List<ActifioRoles> getUserRole() {
return userRole;

public void setUserRole(List<ActifioRoles> userRole) {
this.userRole = userRole;
public String getMiddleName() {
return middleName;
public void setMiddleName(String middleName) {
this.middleName = middleName;
public Integer getPhoneNo() {
return phoneNo;
public void setPhoneNo(Integer phoneNo) {
this.phoneNo = phoneNo;

public List<com.actifio.domain.Address> getUserAddress() {
return userAddress;
public void setUserAddress(List<com.actifio.domain.Address> userAddress) {
this.userAddress = userAddress;
public Tenant getTenantDetails() {
return tenantDetails;
public void setTenantDetails(Tenant tenantDetails) {
this.tenantDetails = tenantDetails;
public String getToken() {
return token;
public void setToken(String token) {
this.token = token;


How can I Solve this?

Answer Source

I had a similar problem with lazy loading via the hibernate proxy object. Got around it by annotating the class having lazy loaded private properties with:

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

I assume you can add the properties on your proxy object that breaks the JSON serialization to that annotation.

The problem is that entities are loaded lazy and serialization happens before they get loaded fully.

Hibernate.initialize(<your getter method>);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download