[ACCEPTED]-No message body writer has been found for response class ArrayList-cxfrs

Accepted answer
Score: 20

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:

public class Container {
    public List yourlist;
Score: 4

See this, Its JAXB thats giving you problems, it 2 doesn't know how to unmarshal/marshal a 1 List.

Score: 1

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

Score: 0

To avoid the wrapping, one can use Jackson. On 2 how to do it, you can follow my answer for a similar 1 question.

Score: 0

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