org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: [Lmodels.Person; of media type: application/json
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:67)
------------------------
curl http://localhost:8080/mrs/api/persons
Could not find MessageBodyWriter for response object of type: [Lresteasysample.jaxrs.Person; of media type: application/json
-----------------
@Path("/persons")
public class PersonController {
...
List<Person> persons = Arrays.asList(
new Person("Speed Light"),
new Person("Slow Snail"),
new Person("Water Flow"));
@GET
@Consumes(
@Produces({"application/json", "application/xml"}
)
public Person[] get()
}
XmlRootElement(name = "Person")
public class Person {
private static int count = 1;
private String pid;
private String name;
private boolean sex = false;
private int age;
public Person() {
}
public Person(String name)
{ this.name = name; pid = "" + count; age = Integer.parseInt(count + "" + count); count++; } @XmlElement
public String getName()
... // other setters getters
}
------------
I have also posted the same issue here:
http://stackoverflow.com/questions/30616954/resteasy-3-0-9-final-nomessagebodywriterfoundfailure