I get the following error message, I have a Status class, but it is not recognized. I have no idea how to proceed further and could not find an answer on the Internet.
Error
org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "Status" (class com.myproject.ticket.EventsResponse), not marked as ignorable (3 known properties: "events", "status", "page"]) .... Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Status" (class com.myproject.ticket.EventsResponse), not marked as ignorable (3 known properties: "events", "status", "page"])
EventsResponse
@XmlRootElement(name = "EventsResponse") @XmlAccessorType(XmlAccessType.FIELD) public class EventsResponse { @XmlElement(name = "Status") private Status status; @XmlElement(name = "Paging") private Page page; @XmlElementWrapper(name="Events") @XmlElement(name = "Event") private List<Event> events; .....
Status
@XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Status { @XmlElement(name = "Version") private double version; @XmlElement(name = "TimeStampUtc") private Date timeStampUtc; @XmlElement(name = "Code") private int code; @XmlElement(name = "Message") private String message; @XmlElement(name = "Details") private String details;
answer
<EventsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Status> <Version>2.0</Version> <TimeStampUtc>2016-06-11T09:32:21</TimeStampUtc> <Code>0</Code> <Message>Success</Message> <Details /> </Status> <Paging> <PageNumber>1</PageNumber> <PageSize>50</PageSize> <PageResultCount>15</PageResultCount> <TotalResultCount>15</TotalResultCount> <TotalPageCount>1</TotalPageCount> </Paging> <Events> <Event>
I have added the following to the status, but I am still getting the same error.
@XmlElement(name = "Status") @JacksonXmlProperty(localName = "Status") private Status status;
source share