您的位置:首页 > 理论基础 > 计算机网络

http 500 Internal Server Error的错误 ajax请求后台获取不到返回值,返回500 Internal Server Error服务器错误

2019-08-20 15:10 2839 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/bugle_call/article/details/99845310

问题:

用ajax与后台交互的时候,后台能查询出数据只是再返回到ajax中的时候报500Internal Server Error,并且返回的参数都为空

解决:

1、查看谷歌浏览器检查ajax情况:
Type Exception Report
Message No converter found for return value of type: class com.zwan.util.ResultUtil
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.zwan.util.ResultUtil

2、发现找不到类型为com.zwan.util.resultutil的返回值的转换器:No converter found for return value of type: class com.zwan.util.ResultUtil

No converter found for return value of type解决方法
错误为没有该类型值的转换器,但是@responseBody注解会自动将返回数据封装成json格式,前台接收不到json对象,应该为json包版本冲突问题。

  • 查看有没有json包,我是缺少json包导致的,使用2.7.4版本后就可以了;
  • 查看使用的json包的版本是否冲突,换一个版本

更换json包的版本要注意spring和json版本兼容问题

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐