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. Linq 使用注意

    今天在使用Linq的时候,查询很慢.仔细查看在知道,在in的后面跟的是个方法,这个方法返回一个集合. Linq只是语法糖,内部进行了封装.内部的实现也是遍历集合,找到满足条件的元素. 在in的后面使用 ...

  2. 如何使用angularjs实现抓取页面内容

    <html ng-app="myApp"> <head> <title>angularjs-ajax</title> <scr ...

  3. VMware Workstation的网络连接方式:NAT、桥接和Host Only

    安装完VMware Workstation后会自动生成两个网络连接:VMware Network Adapter VMnet8 和 VMware Network Adapter VMnet1(通常称为 ...

  4. Java之字节码(2) - .class文件格式详解

    转载来自 小介:去 年在读<深入解析JVM>的时候写的,记得当时还想着用自己的代码解析字节码的,最后只完成了一部分.现在都不知道还有没有保留着,貌似Apache有现 成的BCEL工程可以做 ...

  5. 保护心灵窗口——防蓝光软件f.lux

    一款根据时间变化来自动改变屏幕色温的软件.让你在深夜也能感受到太阳的温暖,顺便还有助于睡眠.相较于花大价钱购置防蓝光屏或者防蓝光膜,这款软件还是excellent的 首先,概念科普(蓝光的危害就略略略 ...

  6. Mysql Communications link failure 问题的解决

    问题现象 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last p ...

  7. Python isdecimal() 方法

    描述 Python isdecimal() 方法检查字符串是否只包含十进制字符.这种方法只存在于unicode对象. 注意:定义一个十进制字符串,只需要在字符串前添加 'u' 前缀即可. 语法 isd ...

  8. django 错误信息

    一.No module named 'requests' 安装: pip install django-salmonella 二.No module named 'requests' 安装: pip ...

  9. windows 2003 群集

    http://www.tudou.com/programs/view/-UZoSIuUvXs/

  10. django-1.11.3 源码详解 -- 0001 django-admin.py 的调用逻辑

    django-admin是django的命令行接口.可以用它来创建工程(startproject) .创建app(startapp).它里面又是怎么写的呢? 一.django-admin.py 的内容 ...