gMVC异常报406 (Not Acceptable)的解决办法
来源:互联网 发布:jsp博客系统源码 编辑:程序博客网 时间:2024/04/29 03:43
使用SpsringMVC,使用restEasy调试,controller请求设置如下:
请求,debug跟踪list是返回值没有问题,但是前台页面报如下错误:
Response RAW返回值如下,(前半部分)
后台提示错误:
引起的原因:
由于设置了@ResponseBody,要把对象转换成json格式,缺少转换依赖的jar包,故此错。
解决办法:
加入依赖的jar,jackson-core-asl-1.9.12.jar,jackson-mapper-asl-1.9.12.jar问题解决。
- @RequestMapping(value="/list",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE)
- @ResponseBody
- public List<EditTimeout> list(){
- List<EditTimeout> list = editImpl.selectAll();
- return list;
- }
请求,debug跟踪list是返回值没有问题,但是前台页面报如下错误:
- Response Status: 406 (Not Acceptable)
Response RAW返回值如下,(前半部分)
- HTTP GET http://127.0.0.1:8080/onlineLibrary/rest/system/editTimeout/list
- Host: 127.0.0.1:8080
- 406 Not Acceptable
- Date: Sat, 17 Aug 2013 11:01:07 GMT
- Server: Apache-Coyote/1.1
- Content-Length: 1067
- Content-Type: text/html;charset=utf-8
- <html><head><title>Apache Tomcat/7.0.34 - Error report</title><style>
后台提示错误:
- 2013-08-1719:01:03,116 DEBUG org.springframework.web.servlet.DispatcherServlet -Last-Modified valuefor [/onlineLibrary/rest/system/editTimeout/list] is: -1
- 2013-08-1719:01:07,606 DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver -Resolving exception from handler [public java.util.List<com.online.ol.filter.EditTimeout> com.online.ol.filter.EditTimeoutContoller.list()]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
- 2013-08-1719:01:07,680 DEBUG org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver -Resolving exception from handler [public java.util.List<com.online.ol.filter.EditTimeout> com.online.ol.filter.EditTimeoutContoller.list()]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
- 2013-08-1719:01:07,681 DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver -Resolving exception from handler [public java.util.List<com.online.ol.filter.EditTimeout> com.online.ol.filter.EditTimeoutContoller.list()]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
引起的原因:
由于设置了@ResponseBody,要把对象转换成json格式,缺少转换依赖的jar包,故此错。
解决办法:
加入依赖的jar,jackson-core-asl-1.9.12.jar,jackson-mapper-asl-1.9.12.jar问题解决。
0 0
- gMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC异常报406 (Not Acceptable)的解决办法
- SpringMVC ajax 请求报错:406 Not Acceptable 的解决办法 使用@ResponseBody注解
- SpringMvc406(Not Acceptable)的解决办法
- SpringMVC - 406 Not Acceptable异常的可能原因及解决方案
- SpringMVC报406 Not Acceptable错误
- SpringMVC报406 Not Acceptable错误
- js前端报406 (Not Acceptable)
- springMVC后台没有错误 但是前台报错406 Not Acceptable 的原因
- 最近使用spring4.0的Mvc,json请求时,客户端报错,406 Not Acceptable
- 使用spring的@ResponseBody注解报Not Acceptable错误
- Spring MVC 报错:Response Status: 406 (Not Acceptable)
- SpringMVC ajax post 提交数据,报错406:Not Acceptable
- 5. linux文件系统
- JQuery获取和设置select下拉框的值
- STL 中的排序
- MYSQL管理之主从同步管理
- 黑马程序员_日记29_Java基本数据类型对象包装类
- gMVC异常报406 (Not Acceptable)的解决办法
- 习题2-20
- Reverse Bits--LeetCode
- iOS 地图 api MKMapView
- JSON学习总结
- 数组名和数组名取地址的区别
- Memcache 在PHP中的基本用法
- C++刷题三
- 常见的C语言内存出错问题分析