1

I am creating a REST service with jersey.

Here the request handler class's method.

@POST
@Path("/deleteWorkers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deleteWorkers(DeleteWorkerPOJO deleteWorkerPOJO) {......}

This method gives below error

SEVERE: A message body reader for Java type, class <classname>, and MIME media type, application/json, was not found

There are some several POST methods in the same class which does not consume POJOs. They are working fine. And many developers has suggested, I have added jersy-json library and

<param-name>
    com.sun.jersey.api.json.POJOMappingFeature
</param-name>
<param-value>
    true
</param-value>

Still this gives the same error.

Jersey version is 1.2 and java version is 1.5

bula
  • 8,719
  • 5
  • 27
  • 44
  • Everything _looks_ right. Can you post the complete web.xml, pom.xml (just deps), POJO class, and stack trace? – Paul Samsotha Sep 22 '18 at 06:41
  • sorry If my question is stupid, I am new to this area but is @Produces(MediaType.APPLICATION_JSON) necessary ? – GGEv Apr 05 '19 at 10:23

0 Answers0