title: RESTful web service not producing or consuming JSON
body: <p>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</p>
  
  <pre><code>@GET
  @Path("{id}")
  @Produces({MediaType.APPLICATION_JSON})
  public Product find(@PathParam("id") Integer id) {
      return super.find(id);
  }
  </code></pre>
  
  <p>When I try to call the service it throws the following exception:</p>
  
  <pre><code>javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper
  </code></pre>
  
  <p>However, I tried to do what's explained in the answer of this question <a href="https://stackoverflow.com/questions/13594945/how-correctly-produce-json-by-restful-web-service">how correctly produce json by restful web service</a>, but it changed nothing.</p>