title: HttpMediaTypeNotAcceptableException: Could not find acceptable representation spring mvc 4.1.5 with com.fasterxml 2.5.1
body: <p>Help - what else can I do to fix this error?    org.springframework.web.HttpMediaTypeNotAcceptableException:: Could not find acceptable representation.</p>
  
  <p>I think my project is configured properly to handle json restful requests. In the past several days, I have read and applied various suggestions to no avail. Are there any more ideas on what else I should be doing differently?</p>
  
  <p>I am using Spring MVC 4.1.5 and com.fasterxml 2.5.1.</p>
  
  <p>A portion of my pom.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
      &lt;version&gt;2.5.1&lt;/version&gt;
      &lt;type&gt;bundle&lt;/type&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
      &lt;version&gt;2.5.1&lt;/version&gt;
      &lt;type&gt;bundle&lt;/type&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
      &lt;version&gt;2.5.1&lt;/version&gt;
      &lt;type&gt;bundle&lt;/type&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p>Here is my part of my web.xml   </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;!-- Processes application requests --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/spring/appServlet/servlet-context.xml
          &lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Here is part of my servlet-context.xml    </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!-- Enables the Spring MVC @Controller programming model --&gt;
  &lt;annotation-driven /&gt;
  
  &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt;
  &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
  &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt;
  &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt;
      &lt;beans:property name="suffix" value=".jsp" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;context:component-scan base-package="com.losgatos"&gt;
      &lt;context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" /&gt;
  &lt;/context:component-scan&gt;   
  </code></pre>
  
  <p>Here is my controller</p>
  
  <pre><code>package com.losgatos.controllers;
  
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.losgatos.User;
  
  @RestController
  @RequestMapping( "user" )
  public class UserController { 
  
      @RequestMapping( value = "data", produces="application/json" )
      public User getUser(){
          return new User();
      }   
  }
  </code></pre>
  
  <p>Here is the User User POJO</p>
  
  <pre><code>package com.losgatos;
  
  import java.util.EnumSet;
  
  public class User {
  
      public User(){
          id = 0;
          age = 22;
          name = "Titus Feng"; 
          alias = "tornado tie";
          roles = EnumSet.of( Role.NORMAL, Role.NEW );
      }
  
      private int id, age;
      private String name, alias;
      private EnumSet&lt;Role&gt; roles;
  
      //added getters and setters here
  
      public enum Role{
          NEW, NORMAL, ADMIN, MEMBER, DORMANT 
      }   
  }
  </code></pre>