CXF: WARNING: No message body writer has been found for response class ArrayList

cxf

Solution

The problem turns out to be a simple missing Accept header:

Accept: application/json

Adding this to the request resolves the problem.

Problem

I'm getting the following error: ``` WARNING: No message body writer has been found for response class ArrayList. ``` On the following code: ``` @GET @Consumes("application/json") public List getBridges() { return new ArrayList(bridges); } ``` ` I know it's possible for CXF to handle this case because I've done it before - with a platform that defined the CXF and related maven artifacts behind the scenes (i.e. I didn't know how it was done). So, the question: how can I get CXF to support this without adding XML bindings or other source code modifications? Note the following answer addressed the same problem with XML bindings, which is not satisfactory for my case: No message body writer has been found for response class ArrayList

Original source

Related problems