title: Jersey body writer errors for java.lang.Boolean when deployed
body: <p>I'm having trouble hunting down the the problem behind <code>SEVERE: A message body writer for Java class java.lang.Boolean, and Java type class java.lang.Boolean, and MIME media type application/json was not found</code>.</p>
  
  <p><strong>Here's what I've tried:</strong></p>
  
  <ul>
  <li>using <code>jersey-bundle</code> instead of these individual packages</li>
  <li>POJOMappingFeature is already enabled</li>
  <li>Adding Jackson as a dependency</li>
  </ul>
  
  <p>I'm unclear on what else I need to do.  This runs fine locally, so I'm unclear on why a dependency or two are not being packaged with the rest of the application.</p>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>    &lt;jersey-version&gt;1.17.1&lt;/jersey-version&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    &lt;!-- Jersey --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
          &lt;version&gt;${jersey-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-servlet&lt;/artifactId&gt;
          &lt;version&gt;${jersey-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-json&lt;/artifactId&gt;
          &lt;version&gt;${jersey-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-spring&lt;/artifactId&gt;
          &lt;version&gt;${jersey-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Jersey Servlet</strong></p>
  
  <pre><code>//add jersey servlet support
  ServletRegistration jerseyServletRegistration = ctx.addServlet("JerseyServlet", new SpringServlet());
  jerseyServletRegistration.setInitParameter("com.sun.jersey.config.property.packages", "com.company.product.resource");
  jerseyServletRegistration.setInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", "com.company.product.resource.ResponseCorsFilter");
  jerseyServletRegistration.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", Boolean.TRUE.toString());
  jerseyServletRegistration.setInitParameter("com.sun.jersey.config.feature.DisableWADL", Boolean.TRUE.toString());
  jerseyServletRegistration.setInitParameter("org.codehaus.jackson.map.DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY", Boolean.TRUE.toString());
  jerseyServletRegistration.setLoadOnStartup(1);
  </code></pre>
  
  <p><strong>My build process</strong></p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;&lt;goal&gt;shade&lt;/goal&gt;&lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;transformers&gt;
                              &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                                  &lt;mainClass&gt;com.company.product.Main&lt;/mainClass&gt;
                              &lt;/transformer&gt;
                          &lt;/transformers&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;skip&gt;true&lt;/skip&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p><strong>The exception:</strong></p>
  
  <pre><code>SEVERE: A message body writer for Java class java.lang.Boolean, and Java type class java.lang.Boolean, and MIME media type application/json was not found
  SEVERE: The registered message body writers compatible with the MIME media type are:
  */* -&gt;
    com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
  </code></pre>
  
  <p><strong>Code that generates error:</strong></p>
  
  <pre><code>@Path("/system")
  public class SystemResource extends BaseResource {
      @GET
      @Path("/isOnline")
      public Boolean isOnline () {
          return Boolean.TRUE;
      }
  }
  
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public class BaseResource {
  
  }
  </code></pre>
  
  <p>I've verified that via the package log that jersey-json is being included in my jar.  One area of uncertainty for me is <strong>which package/class actually provides the message body writer for Boolean?</strong></p>
  
  <p><strong>Bounty</strong> was added because this is preventing me from running in our production environment and we really need this resolved.</p>