This is a slight variation to the question here. I'm not using Maven but have the jersey-bundle-1.17.1 included in the classpath. It seems to include all the classes in jersey-json. However I also added jersey-json to classpath and WEB-INF/lib and get the same error. I'm POSTing json
{ to: 'John', company: 'Costo' }
Anything obvious?
Recipient is simple POJO with two string fields - to and company
@POST
@Path("/saveit")
@Consumes(MediaType.APPLICATION_JSON )
@Produces( MediaType.APPLICATION_JSON )
public Response saveit(Recipient rec) {
System.out.println(rec);
....
}
But I still get the error:
Apr 20, 2014 8:17:23 PM com.sun.jersey.spi.container.ContainerRequest getEntity
SEVERE: A message body reader for Java class com.company.guestbook.model.Recipient, and Java type class com.company.guestbook.model.Recipient, and MIME media type application/json was not found.
The registered message body readers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
...