title: Netbeans' RESTful Java Client : javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable
body: <p>I'm developing a web service using <strong>RESTful web service</strong> of Netbeans. The service class contains following method:</p>
  
  <pre><code>@Path("jpost")
  @POST
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.TEXT_PLAIN)
  public String jpost(Car c){
      return "Car:"+c.getTag()+"\t"+c.getName()+"\t"+c.getColor();
  }
  </code></pre>
  
  <p>For testing this method, I'm using <strong>Netbeans' RESTful Java Client</strong> to generate test method. The result is:</p>
  
  <pre><code>public String jpost(Object requestEntity) throws ClientErrorException {
          return webTarget.path("jpost").request(javax.ws.rs.core.MediaType.APPLICATION_JSON).post(javax.ws.rs.client.Entity.entity(requestEntity, javax.ws.rs.core.MediaType.APPLICATION_JSON), String.class);
      }
  </code></pre>
  
  <p>When i call <code>jpost</code> following error appear:</p>
  
  <pre><code>Exception in thread "main" javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable
      at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:923)
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:770)
      at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:90)
      at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:671)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:422)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:667)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:423)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:326)
      at myserver.test5.jpost(test5.java:36)
      at myserver.MyServerTest.main(MyServerTest.java:32)
  </code></pre>
  
  <p>What is the problem?</p>