getOutputStream() has already been called for this response
最近遇到的一个问题 getOutputStream() has already been called for this response
,下面是参考资料,mark 一下。
getOutputStream() has already been called for this response异常的原因和解决方法[转]
java.lang.IllegalStateException: getOutputStream() has already been called for this response
JSP : getOutputStream() has already been called for this response
java.lang.IllegalStateException: getOutputStream() has already been called for this response
最后面贴一下日志:
27-Jun-2017 16:41:34.401 SEVERE [http-nio-8101-exec-19] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet dispatcherServlet threw exceptionjava.lang.IllegalStateException: getOutputStream() has already been called for this responseat org.apache.catalina.connector.Response.getWriter(Response.java:564)at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:212)at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:207)at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:113)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)at org.springframework.boot.context.web.ErrorPageFilter.handleErrorStatus(ErrorPageFilter.java:154)at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:122)at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:61)at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:95)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:113)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:745)
恐怖的日志。。。