Wednesday 24 August 2016

com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException


com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: org.apache.catalina.connector.CoyoteInputStream@76ab2e75; line: 3, column: 25] (through reference chain: com.group.dto.EmployeeDto["orderDto"])

Solution :
1. Json mapping should be done, when list object is added as property.

ex : Customer {
private int id;
private int name;
// missing json mapping annotation
private List<OrderDto> orderDto;
}
OrderDto {
pivate int orderId;
private String orderName;

}
2. Changes add @JsonProperty("orderList")

Customer {
private int id;
private int name;
// missing json mapping annotation
private List<OrderDto> orderDto;
}

No comments:

Post a Comment