title: javax.ws.rs.ProcessingException: could not find writer for content-type application/json
body: <p>I am new to REST web services. Am trying @post and @consumes annotation as below</p>
  
  <pre><code>@POST
  @Path("/post")
  @Consumes("application/json")
  public Response createProductInJSON(Product product) {
      String result = "Product created : " + product;
      return Response.status(201).entity(result).build();
  }
  </code></pre>
  
  <p><strong>Edit</strong>
  Product Class </p>
  
  <pre><code>public class Product {
      String name;
      int qty;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public int getQty() {
          return qty;
      }
  
      public void setQty(int qty) {
          this.qty = qty;
      }
  }
  </code></pre>
  
  <p>Now I want to test this, so am using the below code to test.</p>
  
  <pre><code>Product product=new Product();
      product.setName("windows_phone");
      product.setQty(4);
  
      ResteasyClient client = new ResteasyClientBuilder().build();
      ResteasyWebTarget target = client.target("http://localhost:8080/Rest_Services/practice/service/post");
  
      Response response = target.request().post(Entity.entity(product, "application/json"));
  
      if (response.getStatus() != 200) {
          throw new RuntimeException("Failed : HTTP error code : "+ response.getStatus());
      }
  
      System.out.println("Server response : \n");
      System.out.println(response.readEntity(String.class));
      response.close();
  </code></pre>
  
  <p>Am getting the below error when executed. </p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (org.jboss.resteasy.plugins.providers.DocumentProvider).
  log4j:WARN Please initialize the log4j system properly.
  Exception in thread "main" javax.ws.rs.ProcessingException: Unable to invoke request
  at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287)
  
  Caused by: javax.ws.rs.ProcessingException: could not find writer for content-type application/json type: com.model.Product
  at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)
  at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:138)
  </code></pre>
  
  <p>Below are the Jars am using.</p>
  
  <p><a href="https://i.stack.imgur.com/jEMVv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jEMVv.jpg" alt="enter image description here"></a></p>
  
  <p><strong>EDIT 3</strong>
  POM.XML</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;rest_maven&lt;/groupId&gt;
  &lt;artifactId&gt;rest_maven&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;build&gt;
  &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;version&gt;3.0&lt;/version&gt;
      &lt;configuration&gt;
        &lt;source&gt;1.7&lt;/source&gt;
        &lt;target&gt;1.7&lt;/target&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.3&lt;/version&gt;
      &lt;configuration&gt;
        &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
        &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
  &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;1.5.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;2.3.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-logging&lt;/groupId&gt;
          &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
          &lt;version&gt;1.1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.9&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.activation&lt;/groupId&gt;
          &lt;artifactId&gt;activation&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;version&gt;4.3.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpcore&lt;/artifactId&gt;
          &lt;version&gt;4.3.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.spec.javax.annotation&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-annotations-api_1.1_spec&lt;/artifactId&gt;
          &lt;version&gt;1.0.1.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.jcip&lt;/groupId&gt;
          &lt;artifactId&gt;jcip-annotations&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.14&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-client&lt;/artifactId&gt;
          &lt;version&gt;3.0.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
          &lt;version&gt;3.0.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;jaxrs-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jaxb-provider&lt;/artifactId&gt;
          &lt;version&gt;3.0.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jackson2-provider&lt;/artifactId&gt;
          &lt;version&gt;3.0.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>settings.xml</strong></p>
  
  <pre><code>&lt;settings&gt;
  &lt;localRepository&gt;Z:\PROD_Deploy\mvn\repository&lt;/localRepository&gt;
  
  &lt;proxies&gt;
  &lt;proxy&gt;
    &lt;active&gt;true&lt;/active&gt;
    &lt;protocol&gt;http&lt;/protocol&gt;
    &lt;username&gt;xxx&lt;/username&gt;
    &lt;password&gt;xxx&lt;/password&gt;
    &lt;host&gt;xxx&lt;/host&gt;
    &lt;port&gt;80&lt;/port&gt;
    &lt;nonProxyHosts&gt;local.net|some.host.com&lt;/nonProxyHosts&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Please help me get through this error.
  Thanks in advance.</p>