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

问题:

用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版本兼容问题

猜你喜欢

转载自blog.csdn.net/bugle_call/article/details/99845310