title: Not Acceptable error showing while calling response from ajax in SPRING
body: <p>I am trying to get response in form of json array from controller class. When I tried to send request from javascript, I get "Not Acceptable" error. Please help to find b ug in my code.</p>
  
  <p>This is my controller's code</p>
  
  <pre><code>@RequestMapping(value = "/ajaxvalue", method = { RequestMethod.GET }, produces=MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody Map&lt;String, String&gt; geResourceList(String name){
          logger.info("getAllResources() from ajax begins: ");
          Map&lt;String, String&gt; resourceMap = null;
          try {
              logger.info("getAllResources() from ajax begin: ");
              resourceMap = new HashMap&lt;String, String&gt;();
              List&lt;ResourceModel&gt; resourceList = resourceService
                      .getAllResources();
              java.util.Iterator&lt;ResourceModel&gt; resourceIterator = resourceList.iterator();
              while (resourceIterator.hasNext()) {
                  ResourceModel model = resourceIterator.next();
                  resourceMap.put("" + model.getResourceType(),
                          model.getName());
                  logger.info("" + model.getResourceType(),
                          model.getName());
              }
  
          } catch (Exception e) {
              logger.debug("Error while getting location in ajax request:"
                      + e.getMessage());
              e.printStackTrace();
          }logger.info("getAllResources() from ajax ENDS: ");
          return resourceMap;
      }
  </code></pre>
  
  <p>This is my jquery code.</p>
  
  <pre><code>jQuery.ajax({
  url: '&lt;c:url value='/learningresources/ajaxvalue'/&gt;',
  type: 'GET',
  dataType:'json',
  contentType: "application/json",
  cache:false,
  success:function(response){
      alert(response);
  },
  error:function(jqXhr, textStatus, errorThrown){
      alert("error: "+errorThrown);
  }
  });
  </code></pre>