您的位置:首页 > 编程语言 > Java开发

springmvc获取json Failed to load resource: the server responded with a status of 406 (Not Acceptable)

2015-07-15 19:09 826 查看
使用springmvc3.1版本时通过@ResponseBody标签返回JSON数据的方法都报406错: Failed to load resource: the server responded with a status of 406 (Not Acceptable) 经过调试发现少了jackson-core-asl和jackson-mapper-asl两jar包,导入了1.9版本的jar后,问题解决了。

在解决上面问题的时候,顺便在网上发现Spring 3.2版本的BUG:Spring 3.2.x通过@ResponseBody标签返回JSON数据的方法都报406错,该错误不是jar包没导入的问题,而是spring3.2的bug,因为spring 3.2的requestedMediaTypes为[text/html]的情况导致报406错误,而3.1的requestedMediaTypes为[*/*]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: