title: MessageBodyWriter not found for media type=application/json
body: <p>I am facing issues while consuming JAX-RS services as JSON.</p>
  
  <p>Below I have added my code.</p>
  
  <p>This is my service class:</p>
  
  <pre><code>//Sets the path to base URL + /hello
  @Path("/hello") 
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public class Hello {
  
      @GET
      @Produces("application/json")
      public Student getStudent() {
  
          Student s = new Student();
          s.first_name = "Test First Name !!!";
          s.last_name = "Test Last Name!!!";
  
          return s;
      }
  </code></pre>
  
  <p><code>Student</code> class which I am trying to get from service:</p>
  
  <pre><code>@XmlRootElement
  public class Student implements Serializable {
  
      public String first_name;
      public String last_name;
  
      public String getFirst_name() {
          return first_name;
      }
  
      public void setFirst_name(String first_name) {
          this.first_name = first_name;
      }
  
      public String getLast_name() {
          return last_name;
      }
  
      public void setLast_name(String last_name) {
          this.last_name = last_name;
      }
  
      public Student()
      {
          first_name = "Fahad";
          last_name = "Mullaji";
      }
  }
  </code></pre>
  
  <p>Web XML on service side.</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"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      id="WebApp_ID" version="3.0"&gt;
      &lt;display-name&gt;com.vogella.jersey.first&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;!-- Register resources and providers under com.vogella.jersey.first package. --&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
              &lt;param-value&gt;com.vogella.jersey.first&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
              &lt;param-value&gt;true&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>I don't know how to fix this issue.
  I am using SOAP UI for testing JSON response but I guess that it should not matter.</p>
  
  <p>Many places I read that I need to add the code below. But I don't know where. I am not using Maven for building.</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Server is looking for function to parse <code>Student</code> object to JSON but it is not able to find function or jar file for it. 
  I have added jar of Genson, Moxy, RESTEasy and Jackson but I think that's the problem.
  I think I am missing mapping somewhere.</p>