http://jadethao.iteye.com/blog/1926525

——————————————————————————————————————————————————————————————————

使用SpsringMVC,使用restEasy调试,controller请求设置如下:

  1. @RequestMapping(value="/list",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_VALUE)
  2. @ResponseBody
  3. public List<EditTimeout> list(){
  4. List<EditTimeout> list = editImpl.selectAll();
  5. return list;
  6. }

请求,debug跟踪list是返回值没有问题,但是前台页面报如下错误:

  1. Response Status: 406 (Not Acceptable)

Response RAW返回值如下,(前半部分)

  1. HTTP GET http://127.0.0.1:8080/onlineLibrary/rest/system/editTimeout/list
  2. Host: 127.0.0.1:8080
  3. 406 Not Acceptable
  4. Date: Sat, 17 Aug 2013 11:01:07 GMT
  5. Server: Apache-Coyote/1.1
  6. Content-Length: 1067
  7. Content-Type: text/html;charset=utf-8
  8. <html><head><title>Apache Tomcat/7.0.34 - Error report</title><style>

后台提示错误:

  1. 2013-08-17 19:01:03,116 DEBUG org.springframework.web.servlet.DispatcherServlet -Last-Modified value for [/onlineLibrary/rest/system/editTimeout/list] is: -1
  2. 2013-08-17 19: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
  3. 2013-08-17 19: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
  4. 2013-08-17 19: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问题解决。

http://jadethao.iteye.com/blog/1926525的更多相关文章

  1. [z]oracle优化http://jadethao.iteye.com/blog/1613943

    [sql] view plaincopy SQL> create table t as select 1 id,object_name from dba_objects; Table creat ...

  2. http://chenzhou123520.iteye.com/blog/1811340

    http://chenzhou123520.iteye.com/blog/1811340

  3. [转]http://m635674608.iteye.com/blog/1750833

    转载地址:http://m635674608.iteye.com/blog/1750833 在第一次使用TortoiseSVN从服务器CheckOut的时候,会要求输入用户名和密码,这时输入框下面有个 ...

  4. rabbitMq 转自 http://gaoyangang.iteye.com/blog/1566600

    rabbitMq  转自 http://gaoyangang.iteye.com/blog/1566600

  5. http://jinnianshilongnian.iteye.com/blog/1996071

    http://jinnianshilongnian.iteye.com/blog/1996071 http://my.oschina.net/jkcui/blog/388400 http://tian ...

  6. http://jinnianshilongnian.iteye.com/blog/2018936

    http://jinnianshilongnian.iteye.com/blog/2018936

  7. http://wsj356428476.iteye.com/blog/1655032

    http://wsj356428476.iteye.com/blog/1655032 http://jingyan.baidu.com/article/19192ad83ce167e53e570705 ...

  8. spring mvc入门教程 转载自【http://elf8848.iteye.com/blog/875830】

    目录  一.前言二.spring mvc 核心类与接口三.spring mvc 核心流程图 四.spring mvc DispatcherServlet说明 五.spring mvc 父子上下文的说明 ...

  9. 《C和指针(Pointer on c)》 学习笔记(转自:http://dsqiu.iteye.com/blog/1687944)

    首先本文是对参考中三个连接的博客进行的整理,非常感谢三位博主的努力,每次都感叹网友的力量实在太强大了…… 第一章 快速上手 1.  在C语言中用/*和*/来注释掉这段代码,这个实际上并不是十分的安全, ...

随机推荐

  1. 【pyhon】怨灵侍全本漫画批量下载爬虫1.00

    代码: # 怨灵侍全本漫画批量下载爬虫1.00 # 拜CARTOON.fydupiwu.com整理有序所赐,寻找图片只要观察出规律即可,不用费劲下一页的找了 import time import ur ...

  2. hdu 5247 找连续数(思维)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5247 找连续数 Time Limit: 2000/1000 MS (Java/Others)    M ...

  3. Oracle中CBO优化器简介

    Oracle中CBO优化器简介 Oracle数据库中的优化器是SQL分析和执行的优化工具.它负责制定SQL的执行计划,也就是它负责保证SQL的执行计划的效率最高,比如优化器决定Oracle以什么样的方 ...

  4. javascript 闭包 通俗解释

    代码段 function foo(){ var a = 2; function bar(){ console.log(a); } return bar; } var baz = foo(); baz( ...

  5. js与jQuery实现方式对比汇总

      CreateTime--2016年12月16日09:11:23Author:Marydonjs与jQuery实现方式对比汇总 <div id="ListContainer" ...

  6. 【TP3.2】模板引用头和尾.html文件

    传送门:http://document.thinkphp.cn/manual_3_2.html#include 使用模版表达式 模版表达式的定义规则为:模块@主题/控制器/操作 例如: <inc ...

  7. perl: warning: Setting locale failed.

    本篇文章由:http://xinpure.com/perl-warning-setting-locale-failed/ 将 mac 系统切换成英文后,使用 git 命令出现如下错误: perl: w ...

  8. Django模版中的过滤器详细解析 Django filter大全

    就象本章前面提到的一样,模板过滤器是在变量被显示前修改它的值的一个简单方法. 过滤器看起来是这样的: {{ name|lower }} 显示的内容是变量 {{ name }} 被过滤器 lower 处 ...

  9. 关闭危害的端口DOS命令(转载)

    rem ipseccmd -w REG -p "HFUT_SECU" -r "Block UDP/137" -f *+0:137:UDP -n BLOCK -x ...

  10. centos gnome桌面放大

    我不知道gnome 为什么要这么做.但是真的有效: gsettings set org.gnome.desktop.interface scaling-factor # 放大2倍