title: SEVERE: MessageBodyWriter not found for media type=application/json, type=class com.jersey.jaxb.Todo, genericType=class com.jersey.jaxb.Todo
body: <p>I am trying to create a RESTful web-service and I created one but I am getting a </p>
  
  <blockquote>
    <p>MessageBodyWriter not found for media type=application/json error</p>
  </blockquote>
  
  <p>My <code>Todo</code> class:</p>
  
  <pre><code>package com.jersey.jaxb;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlType;
  import org.pojomatic.Pojomatic;
  import org.pojomatic.annotations.AutoProperty;
  
  @XmlRootElement
  @XmlType(name = "todo")
  @XmlAccessorType(XmlAccessType.FIELD)
  @AutoProperty
  public class Todo {
  
      @XmlElement(name = "summary")
      private final String summary;
  
      @XmlElement(name = "description")
      private final String description;
  
      public String getSummary() {
          return summary;
      }
  
      public String getDescription() {
          return description;
      }
  
      public Todo() {
          this(new Builder());    
      }
  
      public Todo(Builder builder) {
          this.summary = builder.summary;
          this.description = builder.description;
      }
  
      @Override
      public boolean equals(Object o) {
          return Pojomatic.equals(this, o);
      }
  
      @Override
      public int hashCode() {
          return Pojomatic.hashCode(this);
      }
  
      @Override
      public String toString() {
          return Pojomatic.toString(this);
      }
  
      public static class Builder {
          private String description;
          private String summary;
  
          public Builder summary(String summary) {
              this.summary = summary;
              return this;
          }
  
          public Builder description(String description) {
              this.description = description;
              return this;
          }
  
          public Todo build() {
              return new Todo(this);
          }
      }
  }
  </code></pre>
  
  <p>And my Resource:-  </p>
  
  <pre><code>package com.jersey.jaxb;
  
  import javax.ws.rs.Path;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.Produces;
  import javax.ws.rs.GET;
  
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.Response.Status;
  
  @Path("/todo")
  public class TodoResource {
  
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      public Response getTodo(){
          Todo todo = new Todo.Builder().description("My Todo Object").summary("Created").build();
          return Response.status(Status.OK).entity(todo).build();
      }
  
  }
  </code></pre>
  
  <p>My web.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
  &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;display-name&gt;MyFirstWebService&lt;/display-name&gt;
  &lt;servlet&gt;
    &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
     &lt;init-param&gt;
       &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
       &lt;param-value&gt;com.jersey.jaxb&lt;/param-value&gt;
     &lt;/init-param&gt;
     &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;  
  </code></pre>
  
  <p>My Libraries:</p>
  
  <pre><code>aopalliance-repackaged-2.4.0-b10.jar
  asm-debug-all-5.0.2.jar
  hk2-api-2.4.0-b10.jar
  hk2-locator-2.4.0-b10.jar
  hk2-utils-2.4.0-b10.jar
  jackson-jaxrs-json-provider-2.2.3.jar
  javassist-3.18.1-GA.jar
  javax.annotation-api-1.2.jar
  javax.inject-2.4.0-b10.jar
  javax.servlet-api-3.0.1.jar
  javax.ws.rs-api-2.0.1.jar
  jaxb-api-2.2.7.jar
  jersey-client.jar
  jersey-common.jar
  jersey-container-servlet.jar
  jersey-container-servlet-core.jar
  jersey-guava-2.17.jar
  jersey-media-jaxb.jar
  jersey-server.jar
  org.osgi.core-4.2.0.jar
  osgi-resource-locator-1.0.1.jar
  persistence-api-1.0.jar
  validation-api-1.1.0.Final.jar
  </code></pre>
  
  <p>When I run this application on Tomcat server and run this : 
  <a href="http://localhost:8080/MyFirstWebService/rest/todo" rel="noreferrer">http://localhost:8080/MyFirstWebService/rest/todo</a>  </p>
  
  <p>I get the error:</p>
  
  <blockquote>
    <p>SEVERE: MessageBodyWriter not found for media type=application/json,
    type=class com.jersey.jaxb.Todo, genericType=class
    com.jersey.jaxb.Todo.</p>
  </blockquote>