0

I wanted to write a very simple client which will access my public git profile and will display it a webpage.

`

final Client client = ClientBuilder.newClient();
 WebTarget webTarget =     client.target( URI.create(
                                           "https://api.github.com/users/mmahawar"));
Response response = webTarget.request(MediaType.APPLICATION_JSON).get();
if (response.getStatus() == 200) {
    JSONObject readEntity = response.readEntity(JSONObject.class);
    return readEntity;
}

When I am running the about code i am getting "No message body reader has been found for class" error.. I have not configured cxf or jettison in my spring application context file. ` Since it's just a simple client do i need them?

Manisha Mahawar
  • 627
  • 6
  • 9
  • add [Jackson](http://jackson.codehaus.org/) to your classpath. It provides a JSON message body reader – Roman Vottner Jan 17 '14 at 18:33
  • 1
    Thanks a lot for your response Roman.. I added jackson to my pom file and still the same project...This is the exact error message I am getting.. "HTTP Status 500 - Request processing failed; nested exception is javax.ws.rs.client.ResponseProcessingException: No message body reader has been found for class org.codehaus.jettison.json.JSONObject, ContentType: application/json;charset=utf-8" – Manisha Mahawar Jan 17 '14 at 20:12
  • Are you using any framework? CXF, RESTlet, ...? There are often specific version for those frameworks available – Roman Vottner Jan 17 '14 at 20:16
  • I was trying to use cxf-rt-rs-client client 3.0 versin – Manisha Mahawar Jan 17 '14 at 20:19
  • [This link here](http://stackoverflow.com/questions/9256112/no-message-body-writer-found-json-apache-cxf-restful-webservices) might help you – Roman Vottner Jan 17 '14 at 20:22

0 Answers0