[ACCEPTED]-No message body writer has been found for response class ArrayList-cxfrs
To return a list, best wrap it into a container 2 annotated @XmlRootElement
and give that container your 1 list as a field, annotated as @XmlElement
.
Like so:
@XmlRootElement
public class Container {
@XmlElement
public List yourlist;
}
See this, Its JAXB thats giving you problems, it 2 doesn't know how to unmarshal/marshal a 1 List.
I've solved it using JacksonJaxbJsonProvider. No 2 Java code needs to be modified. Just few 1 changes in Spring context.xml
and Maven pom.xml
, see https://stackoverflow.com/a/30777172/1245231
To avoid the wrapping, one can use Jackson. On 2 how to do it, you can follow my answer for a similar 1 question.
I have added the List to existing object 6 of the project scope of domain layer.
It 5 was more contextual for project and also 4 worked out-of-the box: no needed to test 3 XmlRootElement, but add the test data+logic 2 for List of existing test case for that 1 object.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.