Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1180

3.0.11.Final and 3.0.9.Final: NoMessageBodyWriterFoundFailure

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: 3.0.9.Final, 3.0.11.Final
    • Fix Version/s: None
    • Component/s: jaxrs
    • Labels:
    • Affects:
      Documentation (Ref Guide, User Guide, etc.), User Experience

      Description

      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(

      {"application/json", "application/xml"})
      @Produces({"application/json", "application/xml"}

      )
      public Person[] get()

      { return return persons.toArray(new Person[0]); }

      }

      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()

      { return name; }

      ... // other setters getters
      }

      ------------
      I have also posted the same issue here:
      http://stackoverflow.com/questions/30616954/resteasy-3-0-9-final-nomessagebodywriterfoundfailure

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ron_sigal Ronald Sigal
                Reporter:
                ongbp Ong Boon Pang
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: