Jquery AutoComplete引发406不可接受的错误

我试图通过以下示例在我的spring mvc应用程序中创建一个自动完成框http://www.mkyong.com/spring-mvc/spring-mvc-jquery-autocomplete-example/每当我尝试获取详细信息时在我的浏览器中显示以下错误NetworkError:406 Not Acceptable这是我的控制器

@RequestMapping(value = "/searchTags.htm", method = RequestMethod.GET) public @ResponseBody List getTags(@RequestParam String tagName) throws Throwable { return fetchData(tagName); } 

这是我的POJO课程

 public class SolrResult { private String id; private String label; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } @Override public String toString() { return "SolrResult [id=" + id + ", label=" + label + "]"; } } 

这是我的javascript

  $(document).ready(function() { $('#inputText').autocomplete({ serviceUrl: '${pageContext.request.contextPath}/searchTags.htm', paramName: "tagName", delimiter: "," transformResult: function(response) { return { suggestions: $.map($.parseJSON(response), function(item) { return { value: item.label, data: item.id }; }) }; } }); });  

我有同样的问题,但我用这种方式修复了使用Gson():

 @RequestMapping(value = "/getCustomer", method = RequestMethod.GET) @ResponseBody String getCustomer(@RequestParam String query) { CustomerDao customerDao = (CustomerDao) ApplicationProperty.getApplicationContext().getBean("CustomerDao"); Gson gson = new Gson(); return gson.toJson(customerDao.getCustomer(query, userProfile)); }