java.lang.IllegalStateException: Cannot call sendError() after the response has been committe

1、问题描述

严重: Servlet.service() for servlet [default] in contextwith path [/OxygenCloud] threw exception

java.lang.IllegalStateException:Cannot call sendError() after the response has been committed

2、问题分析

从提示错误的字面意思判断“Cannotcall sendError() after the response has been committed”,“当response被提交后不能调用sendError()”。

出现这个错误,应该是多次response导致的,可以这么理解,http server发送response后就关闭了socket,这个时候再次发送response给http client就会出现这个问题。

例子:

3、问题解决

查看我的代码里面的情况:

重启运行,这个问题就没有了。

原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/12079402.html

时间: 2024-10-09 22:58:35

java.lang.IllegalStateException: Cannot call sendError() after the response has been committe的相关文章

java.lang.IllegalStateException: Cannot call sendError() after the response has been committed解读

源代码: @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String uri = request.getRequestURI(); if(pathMatcher.match("/", uri)) { System.err.println("跳转"); resp

WARN::Committed before 500 Unable to show problem report:|java.lang.IllegalStateException

2015-01-06 18:23:17.160:WARN::Committed before 500 Unable to show problem report:|java.lang.IllegalStateException: STREAM||Class: org.mortbay.jetty.Response|File: Response.java|Method: getWriter|Line: 616 - org/mortbay/jetty/Response.java:616:-1 2015

java.lang.IllegalStateException错误

严重: Servlet.service() for servlet default threw exceptionjava.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:852) at

java.lang.IllegalStateException: Failed to load ApplicationContext

1.错误描述 INFO:2015-02-05 22:14:21[main] - Loading XML bean definitions from class path resource [applicationContext.xml] INFO:2015-02-05 22:14:22[main] - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning INFO:2015-02-05

java.lang.IllegalStateException: ContainerBase.addChild: start

java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina] Tomcat部署Servlet时出错 caused by: Caused by: java.lang.IllegalArgumentException: Invalid <url-patt

开发中遇到的问题(一)——java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

1.错误描述: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 2.起因: 在Manifest中设置我的activity全屏 1 <activity android:name=".SplashActivity" 2 android:theme="@android:style/Theme.Black.No

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already.

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/services/javax.xml.bind.JAXBContext]. 解决方法:先将项目remove,然后停止服务器,到应用程序目录下将部署的应用删除,然后启动服务器,重新部署就ok了 原因:暂不明确,可能是修改后有原来的残留物.

java.lang.IllegalStateException: getWriter() has already been called for this response

java.lang.IllegalStateException: getWriter() has already been called for this response 出现原因: 1.代码中有打开的Response.getWriter(),未关闭 2.再次使用了ServletOutputStream out = response.getOutputStream(); 通过查看代码,response中的usingWriter=true,想办法将该标志位设置为false. response.r

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError

SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.Exception in thread "main" java.lang.Exception