gpt4 book ai didi

java - Tomcat异常在响应提交后无法调用sendError()?

转载 作者:IT老高 更新时间:2023-10-28 20:33:40 46 4
gpt4 key购买 nike

在我的应用程序中执行一些操作时,我得到了

java.lang.IllegalStateException Cannot call sendError()

当我再次重新加载页面时,它会在一段时间内正常工作,但在一段时间后再次显示相同的异常。我怎样才能克服这个异常?

以下是异常(exception):

HTTP Status 500 - Cannot call sendError() after the response has been committed
type Exception report
message Cannot call sendError() after the response has been committed
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:451)
org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:725)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.40 logs.

Struts.xml

<struts>
<package name="default" extends="hibernate-default">
<action name="addUser" method="add" class="com.demo.action.UserAction">
<result name="input">/register.jsp</result>
<result name="success" type="redirect">list</result>
</action>
<action name="list" method="list" class="com.demo.action.UserAction">
<interceptor-ref name="basicStackHibernate" />
<result name="success">/list.jsp</result>
</action>
</package>
</struts>

最佳答案

我正在创建@ManyToOne 和@OneToMany 关系。我在@ManyToOne 上方添加了 @JsonIgnore 并解决了错误。

关于java - Tomcat异常在响应提交后无法调用sendError()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20813496/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com