ClientHandlerException: A message body reader for Java class not found

I downloaded the Java Wrapper JAR with the dependencies. I've added this to my project and made sure that the  createsend.properties with my API key is in the classpath.

I've used the sample class examples to create a new List. It actually successfully creates the list on the server, however I also get a confusing Exception thrown. It looks like it has something to do with the encoding of the server response, but I'm keeping things pretty simple in my test so not sure what i'm doing wrong. Any help would be greatly appreciated.


Oct 14, 2011 3:28:33 PM com.sun.jersey.api.client.ClientResponse getEntity
SEVERE: A message body reader for Java class java.lang.String, and Java type class java.lang.String, and MIME media type application/json;charset=utf-8 was not found
Oct 14, 2011 3:28:33 PM com.sun.jersey.api.client.ClientResponse getEntity
SEVERE: The registered message body readers compatible with the MIME media type are:
application/json;charset=utf-8 ->
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy

Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class java.lang.String, and Java type class java.lang.String, and MIME media type application/json;charset=utf-8 was not found
    at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:548)
    at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:505)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:605)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:507)
    at com.createsend.util.JerseyClientImpl.post(JerseyClientImpl.java:190)
    at com.createsend.util.JerseyClientImpl.post(JerseyClientImpl.java:182)
    at com.createsend.Lists.create(Lists.java:108)
    at com.test.mail.imp.EmailDispatcherImpl.sendTestCampaign(EmailDispatcherImpl.java:46)
    at com.test.mail.imp.EmailDispatcherImpl.main(EmailDispatcherImpl.java:27)

jfarquhar, 2 years ago

I'm seeing this as well.  Some calls seem to work and return fine.  Others seem to make the call successfully but blow up parsing the response with the stacktrace above.  Anyone know a solution?

acasanovas, 1 year ago

Is there no response on this issue? I am facing it as well. Thanks

Ken Ken, 1 year ago

Sorry about that guys. The solution has been provided here


http://www.campaignmonitor.com

Sign up for free.
Then send campaigns for as little as $9p/m

Create an account