Hibernate项目报错:Cannot call sendError() after the response has been committed
问题描述:
在之前的旧项目上开发一些新功能:其中一个功能是开发系统的操作日志,项目框架是:SSH,由于系统已经上线了,所以系统的操作日志只能用spring 的切面编程进行开发,功能完成后在测试的时候发现了这个问题:
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed:
问题原因:
1):当前对客户端的响应已经结束,不能在响应已经结束后再向 客户端缓冲区输出任何内容。
2):这是双向关系的一个问题,因为它们互相引用,在反序列化时,双向引用导致无限递归。
解决办法:
1):在jsp页面加入如下内容:
<%
out.clear();
out=pageContext.pushBody();
%>
但是本项目前端全部是 html 页面 ,不是jsp 页面所以无法使用。
2):在实体类多对多或者一对多关系字段上增加注解:
@JsonIgnore。
@JsonIgnore:直接直接忽略某个属性,以断开无限递归,序列化或反序列化均忽略:
就这样这个问题完美解决了。
本文地址:https://blog.csdn.net/weixin_38215472/article/details/107536005
上一篇: 酒鬼爆笑,他们谁喝的更多?
下一篇: 哪个季节产的蜂蜜好?蜂蜜有几种哪种更好?
推荐阅读
-
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed解读
-
Cannot call reset() after response has been committed
-
Hibernate项目报错:Cannot call sendError() after the response has been committed
-
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed解读
-
Hibernate项目报错:Cannot call sendError() after the response has been committed
-
Cannot call sendError() after the response has been committed 错误记录
-
Cannot call sendError() after the response has been committed
-
错误提示:Cannot call sendError() after the response has been committed的解决方法
-
Cannot call reset() after response has been committed