I have a project where I use RESTful web service on the server side to get and post data. It works fine if I specify the MediaType as XML (in @Consumes and @Produces, but it doesn't when it comes to JSON. Here is an example of a method
@GET
@Path("{id}")
@Produces({MediaType.APPLICATION_JSON})
public Product find(@PathParam("id") Integer id) {
return super.find(id);
}
When I try to call the service it throws the following exception:
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper
However, I tried to do what's explained in the answer of this question how correctly produce json by restful web service, but it changed nothing.