본문 바로가기
개발자의 공부방/프로젝트

프로젝트] 에러 Stream closed 해결하기

by 쌈빡한 쥬니준 2020. 4. 22.

17:05:22.405 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet][log:175] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

java.io.IOException: Stream closed

at java.io.BufferedWriter.ensureOpen(BufferedWriter.java:116)

at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:126)

at java.io.BufferedWriter.flush(BufferedWriter.java:253)

at org.apache.poi.xssf.streaming.SheetDataWriter.close(SheetDataWriter.java:127)

at org.apache.poi.xssf.streaming.SXSSFSheet.getWorksheetXMLInputStream(SXSSFSheet.java:98)

at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:389)

at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:936)

at kr.co.smartix.common.util.excel.AbstractExcelPOIView.renderMergedOutputModel(AbstractExcelPOIView.java:47)

at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)

at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:141)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)

at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

17:05:22.407 INFO  kr.co.smartix.common.web.CustomErrorController[handleError:33] - httpStatus : 200 OK

17:05:22.415 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[jsp][log:175] - Servlet.service() for servlet [jsp] threw exception

javax.servlet.ServletException: File [/WEB-INF/views/jsp/error/error200.jsp] not found

at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:407)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:374)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:955)

at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:496)

at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)

at org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)

at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)

at org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)

at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)

at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)

at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)

at org.apache.jsp.WEB_002dINF.views.jsp.layout.base_jsp._jspx_meth_tiles_005finsertAttribute_005f1(base_jsp.java:198)

at org.apache.jsp.WEB_002dINF.views.jsp.layout.base_jsp._jspService(base_jsp.java:140)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)

at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:226)

at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)

at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)

at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)

at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147)

at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)

at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)

at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)

at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

17:05:22.418 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[jsp][log:175] - Servlet.service() for servlet [jsp] threw exception

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

at org.apache.catalina.connector.Response.getWriter(Response.java:581)

at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:227)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)

at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)

at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:171)

at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)

at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)

at org.apache.jsp.WEB_002dINF.views.jsp.layout.base_jsp._jspService(base_jsp.java:165)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)

at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:226)

at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)

at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)

at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)

at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147)

at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)

at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)

at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)

at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

17:05:22.423 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet][log:175] - Servlet.service() for servlet [dispatcherServlet] threw exception

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

at org.apache.catalina.connector.Response.getWriter(Response.java:581)

at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:227)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)

at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)

at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:171)

at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)

at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)

at org.apache.jsp.WEB_002dINF.views.jsp.layout.base_jsp._jspService(base_jsp.java:165)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)

at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:226)

at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)

at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)

at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)

at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147)

at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)

at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)

at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)

at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

17:05:22.424 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost][log:175] - Exception Processing ErrorPage[errorCode=0, location=/error]

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/views/jsp/layout/base.jsp'.

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)

at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)

at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/views/jsp/layout/base.jsp'.

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)

at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)

at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:147)

at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373)

at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

... 25 common frames omitted

Caused by: java.io.IOException: ServletException including path '/WEB-INF/views/jsp/layout/base.jsp'.

at org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)

at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:245)

at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:226)

at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)

at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)

at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)

... 35 common frames omitted

Caused by: java.lang.IllegalStateException: getOutputStream() has already been called for this response

at org.apache.catalina.connector.Response.getWriter(Response.java:581)

at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:227)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:114)

at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)

at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)

at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:171)

at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)

at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)

at org.apache.jsp.WEB_002dINF.views.jsp.layout.base_jsp._jspService(base_jsp.java:165)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)

at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)

... 40 common frames omitted

 

 

1. 엑셀 다운로드를 구현하려고 한다.

 

2. 엑셀은 제대로 다운이 되는데 이상하게 Stream closed IOException 이 뜬다.

 

3. 엑셀은 AbstractExcelPOIView 를 이용해서 만들었다.

 

4. AbstractExcelPOIView => ReportExcel extends AbstractExcelPOIView => ReportExcel 컨트롤러.

즉, View => Controller => Service => ServiceImpl => MyBatis Service => Mybatis XML 인데 이 플로우에서 AbstractExcelPOIView를 추가해서 엑셀을 구현했다.

 

5. 일단 Controller 에서 메서드를 void가 아닌 ReportExcel로 했고 return 또한 return new ReportExcel(); 이렇게 했다.

return null 혹은 void 를 하니깐 확실히 에러가 나오지 않았다. 하지만 컨트롤러에서 서비스까지 가지 않았다.

 

6. http://m.blog.daum.net/haha25/5388388?categoryId=228167

outputStream 객체가 이미 닫혀 있는데 거기다가 무언가를 write해서 발생한다 라는 말에서 힌트를 얻었다.

여기서 해결 방법을 찾았는데 위의 Stream closed 에러는 이미 파일을 생성하고 나서 어디선가 Stream이 닫힌건데 또 다시 쓰고 닫으려고 하니깐 에러가 뜨는 것이였다.

 

7. 다시 한번 생각해보니....엑셀을 생성하는 ReportExcel 클래스에서 마지막 부분에 아래와 같이 또 작성해서 에러가 뜬 것이다.

try {
ServletOutputStream out = response.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(out);
workbook.write(out);
bos.close();
//if (out != null) out.close();
out.close();
bos.flush();
out.flush();
} catch (Exception e) {
e.printStackTrace();
}

 

8. 이미 AbstractExcelPOIView 에서 ServletOutPutStream out  = response.getOutputStream(); 을 하고 workbook.write(out) 을 했기 때문에 서비스단에서 굳이 또 할 필요가 없는 것이다.

@Override
protected final void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

Workbook workbook = createWorkbook();

setContentType(CONTENT_TYPE_XLSX);

buildExcelDocument (model, workbook, request, response);

// Set the content type.
response.setContentType(getContentType());

// Flush byte array to servlet output stream.
ServletOutputStream out = response.getOutputStream();
out.flush();
workbook.write(out);
out.flush();
if(workbook instanceof SXSSFWorkbook){
((SXSSFWorkbook) workbook).dispose();
}

// Don't close the stream - we didn't open it, so let the container
// handle it
}

 

9. 8번에 작성한 ServletOutputStream ... 부분을 삭제하면 된다.

댓글0