title: Glassfish :MessageBodyProviderNotFoundException in Jersy Client
body: <p>Hi All I was trying to create a rest web-service from scratch. Here is my Service part</p>
  
  <pre><code>@Path("/Phones")
  public class PhonessResource {
  
   @GET
   @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Response getAllNumbers(){
        List&lt;PhoneDetail&gt; list = PhoneDirectoryDao.getInstance().getAllNumbers();
        GenericEntity&lt;List&lt;PhoneDetail&gt;&gt; entity = new GenericEntity&lt;List&lt;PhoneDetail&gt;&gt;(list) {};
        Response response =Response.ok(entity).status(200).build();
        return response;//PhoneDirectoryDao.getInstance().getAllNumbers();
      }
   }
  </code></pre>
  
  <p>My data Model : I a had my getters and setters along with another constructor that take all property ,I didn't paste it to less the question length ,I use the same data model in client and server</p>
  
  <pre><code>@XmlRootElement(name="PhoneDetail")
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(propOrder={"id","firstName","lastName","address","phoneNo","timeStamp"})
  public class PhoneDetail {
  
      private int id;
      private String firstName;
      private String lastName;
      private String address;
      private String phoneNo;
      private Timestamp timeStamp;
  
      public PhoneDetail() {}
  }
  </code></pre>
  
  <p>Then I create a java client to test the service .I am using NETBEANS IDE ,so I choose default option in IDE to create it</p>
  
  <p><img src="https://i.stack.imgur.com/fyzgT.png" alt="enter image description here"> </p>
  
  <p>Thus I create a Jersey Client </p>
  
  <pre><code>public class PhoneCLient {
      private WebTarget webTarget;
      private Client client;
      private static final String BASE_URI = "http://localhost:8080/Phones/webresources";
  
      public PhoneCLient() {
          client = javax.ws.rs.client.ClientBuilder.newClient();
          webTarget = client.target(BASE_URI).path("Items");
      }
  
  
      public &lt;T&gt; T getAllNumbers_XML(Class&lt;T&gt; responseType) throws ClientErrorException {
          WebTarget resource = webTarget;
          return resource.request(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
      }
  
      public &lt;T&gt; T getAllNumbers_JSON(Class&lt;T&gt; responseType) throws ClientErrorException {
          WebTarget resource = webTarget;
          return resource.request(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
      }
  }
  </code></pre>
  
  <p>But It gives me this error</p>
  
  <pre><code>Exception in thread "main" org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/xml, type=class org.glassfish.jersey.client.ClientResponse, genericType=class org.glassfish.jersey.client.ClientResponse.
      at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:173)
      at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:134)
      at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:988)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:833)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:768)
      at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:96)
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:740)
      at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:88)
      at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:650)
      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:421)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:646)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:375)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:275)
      at PhoneDirectoryClient.rest.PhoneCLient.getAllNumbers_XML(PhoneCLient.java:45)
  </code></pre>
  
  <p>But when I test the service in Browser or RestClient Browser plugin it works fine .
   Can anybody tell me what went wrong ??</p>