Spring MVC json报406错误的解决办法 Failed to load resource: the server responded with a status of 406
2020-02-07 23:00
1021 查看
今天写项目,在写到利用ajax返回数据的时候,项目报错,网页显示报错406
确保了代码没有错,但是还是显示406
发现接收的数据有json格式的
于是看到大佬的一个贴
https://www.geek-share.com/detail/2722073483.html
发现了大佬的第二种解决方法,二:原来springMvc使用@ResponseBody,如果返回的是json结果,需要添加jackson的jar包的依赖
我maven导入包的时候只导入了jackson-databind这个包,缺少了jackson-core-asl和jackson-mapper-asl这两个包,导进去之后
产生新问题找不到包的问题报错,由于我没有截图就没放上图
然后百度了一下说是jackson和spring版本的问题,我用的jackson-databind是2.10.0.pr1的是2019年7月的
我的spring版本是4.0的,然后我将jackson-databind降到2.9.8,然后成功运行
在此再次感谢大佬,大佬的贴地址
https://www.geek-share.com/detail/2722073483.html
[code]
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- Spring MVC json报406错误的解决办法 Failed to load resource: the server responded with a status of 406
- springmvc获取json Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- 解决 Failed to load resource: the server responded with a status of 404 (Not Found) 问题
- 关于使用springmvc时Failed to load resource: the server responded with a status of 400 (Bad Request)错误可能原因
- SprimgMVC:Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- 关于使用springmvc时Failed to load resource: the server responded with a status of 400 (Bad Request)错误可能原因
- Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- Failed to load resource: the server responded with a status of 406 (Not Acceptable)问题的解决方案
- Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
- (springmvc)页面找不到静态资源文件Failed to load resource: the server responded with a status of 404 (Not Found)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- PHP 中 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- ajaxSubmit 报错 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- ajax 报错 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- ripple Failed to load resource: the server responded with a status of 404 (Not Found)
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- 上传文件失败 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 404 (Not Found)