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. 【php】Apache无法自己主动跳转却显示文件夹与php无法连接mysql数据库的解决方式

    一.Apache无法自己主动跳转却显示文件夹 Apache无法自己主动跳转却显示文件夹这是由于Apacheserver下conf/httpd.conf没有配置好,其默认是不跳转,直接显示文件夹 首先, ...

  2. 【python】如何安装requests

    在cmd窗口输入pip install requests 即可,如下 C:\Users\horn1\Desktop\python\4>pip install requestsCollecting ...

  3. 【Cocos2d-x 3.0】游戏开发之android交叉编译

    作者:Senlern 转载请注明,原文链接:http://blog.csdn.net/zhang429350061/article/details/37959489 在上一篇文章我分享了如在win32 ...

  4. aes加密在linux下会生成随机key的解决办法

    直接贴代码了: package com.segerp.tygl.weixin.common; import java.io.UnsupportedEncodingException; import j ...

  5. Simple TCP/IP Echo Server & Client Application in C#

    1. TCP Server The server’s job is to set up an endpoint for clients to connect to and passively wait ...

  6. Java中解压文件名有中文的rar包出现乱码问题的解决

    import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import j ...

  7. Java网络编程-URI和URL

    前提 前面的一篇文章<Java中的Internet查询>分析完了如何通过IP地址或者主机名确定主机在因特网中的地址.任意给定主机上可能会有任意多个资源,这些资源需要有标识符方便主机之间访问 ...

  8. Android EditText禁止复制粘贴

    1,自定义EditText package com.example.ui; import android.annotation.SuppressLint; import android.content ...

  9. 【linux】查看内存和CPU使用情况

    1.内存命令:free 解释:以上数据单位KB. 所以,上面的mem物理内存共1G 下面是对这些数值的解释: total:总计物理内存的大小. used:已使用多大. free:可用有多少. Shar ...

  10. 常用/常见Java Web 服务器/应用服务器Logo图文介绍

    常用/常见应用服务器介绍:自己总结.整理一些常见的应用服务器,资料主要来源于网上.     常用Java Web 服务器Java Web应用程序需要部署在Java web服务器中运行,常用的Java ...