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. POI生成EXCEL文件(字体、样式、单元格合并、计算公式)

    创建一个封装类: package com.jason.excel; import java.io.FileNotFoundException; import java.io.FileOutputStr ...

  2. 21-spring学习-springMVC实现CRUD

    结合业务层实现一共完成CRUD操作 1,定义一共IMessageServese接口 package com.SpringMVC.Service; import java.util.Map; impor ...

  3. zookeeper 入门讲解实例 转

    转  http://www.blogjava.net/BucketLi/archive/2010/12/21/341268.html zookeeper使用和原理探究(一) zookeeper介绍zo ...

  4. EXT-JS 6演示样例程序-Login演示样例程序

    1.        用Sencha Cmd生成应用程序模版 sencha -sdk /path/to/ExtSDK generate app -classic TutorialApp./Tutoria ...

  5. jquery prop('checked', true)解决attr('checked', true)不能选中radio问题

    正如标题所言,使用:prop('checked', true)就可以了

  6. 【LeetCode】106. Construct Binary Tree from Inorder and Postorder Traversal

    Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of ...

  7. spring boot 在什么时候启动的tomcat

    我一直很好奇 spring boot 以哪种方式 启动的 tomcat  今天 特地跟踪了一下 大家都知道 spring 容器很核心的 方式 是org.springframework.context. ...

  8. Faster RCNN原理分析 :Region Proposal Networks详解

    博主的论文笔记: https://blog.csdn.net/YZXnuaa/article/details/79221189 很详细! 另外,关于博主的博客很多拓展知识面: 120篇 深度学习23篇 ...

  9. 点滴积累【JS】---JS实现动画闪烁效果

    效果: 思路:首先获得图片数组,然后做JS定时用setTimeout和setInterval在用显示隐藏实现闪烁效果. 代码: <!DOCTYPE html PUBLIC "-//W3 ...

  10. Redis C#入门

    redis-cli.exe 为客户端 redis-server.exe 为服务端 进行操作都是在客户端上操作,先随便添加一组 key value试一下: 再输入Get "键"名称, ...