While I am trying to return List its throwing No message body writer has been found for response class ArrayList.
I have code as follows:
@POST
@Path("/{scope}/{application}/tables")
@Produces("application/xml")
public List<String> getTableNames(@PathParam("scope") String scope,
@PathParam("application") String application, Request request) {
// For example, I am returning a list of String
return new ArrayList<String>(4);
}
Please help me. Thanks in advance
No message body writer has been found for response class FolderList. I did not test every service but it looks like a problem across all of them.
WARNING: No message body writer has been found for response class ArrayList. 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'm getting the following error: WARNING: No message body writer has been found for response class ArrayList. 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.
Open Source Document Management System | OpenKM - REST -> application/json -> No message body writer has been found for response class FolderList. REST -> application/json -> No message body writer has been found for response class FolderList.
To return a list, best wrap it into a container annotated @XmlRootElement
and give that container your 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 doesn't know how to unmarshal/marshal a List.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With