0

I've created DynamicWeb project (not maven) in eclipse with Target server Tomcat 7.

In location '\WebContent\WEB-INF\lib' I placed jars:
jersey-json-1.19.jar
jersey-bundle-1.19.jar
jersey-core-1.19.jar

in web.xml I have:

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

Pojo:

@XmlRootElement(name = "input")
public class InputOb {
    String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

Rest resource:

@Path("/add")
public class AddOb {

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)   
    public Response add(InputOb input) {
        ....        
    }   
}

When I try to call it, I am getting:

SEVERE: A message body reader for Java class datatypes.InputOb, and Java type class datatypes.InputOb, and MIME media type application/json was not found.

Tirmean
  • 398
  • 7
  • 18
  • This same issue is described [here](https://stackoverflow.com/questions/8594707/jersey-exception-severe-a-message-body-reader-for-java-class), have you tried this? – Catman155 Sep 12 '17 at 14:26
  • to try what ? every thing described there is was implemented – Tirmean Sep 13 '17 at 05:20

1 Answers1

0

Try to add your dependencies through pom.xml and use maven to run. Maybe something goes wrong with the jars.

Catman155
  • 155
  • 1
  • 9