title: How do I use the Jersey JSON POJO support?
body: <p>I have an object that I'd like to serve in JSON as a RESTful resource. I have Jersey's JSON POJO support turned on like so (in web.xml):</p>
  
  <pre><code>&lt;servlet&gt;  
      &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;  
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;
  
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;  
  &lt;/servlet&gt;  
  </code></pre>
  
  <p>But when I try to access the resource, I get this exception:</p>
  
  <pre><code>SEVERE: A message body writer for Java type, class com.example.MyDto, and MIME media type, application/json, was not found
  SEVERE: Mapped exception to response: 500 (Internal Server Error)
  javax.ws.rs.WebApplicationException
  ...
  </code></pre>
  
  <p>The class that I'm trying to serve isn't complicated, all it's got are some public final fields and a constructor that sets all of them. The fields are all strings, primitives, classes similar to this one, or Lists thereof (I've tried using plain Lists instead of generic List&lt;T&gt;s, to no avail). Does anyone know what gives? Thanks!</p>
  
  <p>Java EE 6</p>
  
  <p>Jersey 1.1.5</p>
  
  <p>GlassFish 3.0.1</p>