title: Jquery Ajax throws Error 406--Not Acceptable in Spring MVC
body: <p>I am calling a controller method using Jquery AJAX. My controller method is called properly
  but ajax returns error = Error 406--Not Acceptable.</p>
  
  <p>I have looked at other posts and following all the necessary steps. Am I missing something more?</p>
  
  <p>I am using jackson-core-asl-1.9.4.jar
  jackson-mapper-asl-1.9.4.jar with spring 3.2</p>
  
  <p>My spring-servlet.xml has following   </p>
  
  <pre><code>&lt;context:component-scan  base-package="org.lacare.frc.controller" /&gt;  
  &lt;mvc:annotation-driven&gt;&lt;/mvc:annotation-driven&gt; 
  &lt;context:annotation-config/&gt; 
  </code></pre>
  
  <p>My JSP has following ajax call</p>
  
  <pre><code>$.ajax({
        url: '&lt;c:url  value="getServiceCategoriesForVisitType.html"/&gt;' + '?visitTypeCode=' +$(this).val(),
        data: "",
        type: "GET",
        contentType: "application/json",
        dataType:"json" , 
        success: function(respContent) {
  
         alert(respContent); 
  
         },
         error:function( jqXHR,  textStatus,  errorThrown ){
              alert('error '+errorThrown);
                      }
          });  
  </code></pre>
  
  <p>My Controller method is as follows</p>
  
  <pre><code>   @RequestMapping(value={"/getServiceCategoriesForVisitType"},method=RequestMethod.GET,headers="Accept=*/*",produces = "application/json")
     public @ResponseBody List&lt;String&gt; loadreateVisitType(HttpServletRequest request,@RequestParam(value="visitTypeCode", required=true) long visitTypeCode) {    
  
      List&lt;String&gt; serviceCategories1=new ArrayList&lt;String&gt;();   
      serviceCategories1.add("abc"); 
      serviceCategories1.add("pqr"); 
      return serviceCategories1; 
  
     }
  </code></pre>