已经为此响应调用了GroovyPageView:getOutputStream()

时间:2015-08-26 03:52:18

标签: grails grails-3.0

我使用Grails 3.0.4和Spring Boot 1.2.5

我使用

在我的页面上加载了一个mp3文件
<audio controls><source src="${resource(dir: 'uploads', file: db?.voiceFile + '?_r=' + nowTime)}" /></audio>

HTML标记

当我访问该页面时,Grails后端抛出

ERROR org.springframework.boot.context.web.ErrorPageFilter - Cannot forward to error page for request [/uploads/2/46/52/24652UsE69k/1440557666459n123.jpg] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve
org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: getOutputStream() has already been called for this response
   at org.grails.web.servlet.view.GroovyPageView.createGroovyPageException(GroovyPageView.java:131) ~[grails-web-gsp-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.GroovyPageView.handleException(GroovyPageView.java:108) ~[grails-web-gsp-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:76) ~[grails-web-gsp-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71) ~[grails-web-common-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55) ~[grails-web-common-3.0.4.jar:3.0.4]
   at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.grails.web.sitemesh.GrailsLayoutView.renderInnerView(GrailsLayoutView.java:125) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsLayoutView.obtainContent(GrailsLayoutView.java:106) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsLayoutView.renderTemplate(GrailsLayoutView.java:55) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71) ~[grails-web-common-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55) ~[grails-web-common-3.0.4.jar:3.0.4]
   at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) ~[servlet-api.jar:na]
   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) ~[servlet-api.jar:na]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:295) ~[spring-boot-actuator-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102) ~[spring-boot-actuator-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:73) ~[grails-web-mvc-3.0.4.jar:3.0.4]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67) ~[grails-web-mvc-3.0.4.jar:3.0.4]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) ~[spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:68) ~[spring-boot-actuator-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:116) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:60) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:91) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
   at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:109) [spring-boot-1.2.5.RELEASE.jar:1.2.5.RELEASE]
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.18]
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.18]
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:8.0.18]
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.18]
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:8.0.18]
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.18]
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.18]
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.18]
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.18]
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516) [catalina.jar:8.0.18]
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086) [tomcat-coyote.jar:8.0.18]
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659) [tomcat-coyote.jar:8.0.18]
   at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) [tomcat-coyote.jar:8.0.18]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558) [tomcat-coyote.jar:8.0.18]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515) [tomcat-coyote.jar:8.0.18]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_51]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_51]
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.18]
   at java.lang.Thread.run(Unknown Source) [na:1.8.0_51]

Caused by: java.lang.IllegalStateException: getOutputStream() has already been called for this response
   at org.apache.catalina.connector.Response.getWriter(Response.java:578) ~[catalina.jar:8.0.18]
   at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:212) ~[catalina.jar:8.0.18]
   at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109) ~[servlet-api.jar:3.1.FR]
   at org.grails.web.sitemesh.GrailsPageResponseWrapper$5.activateDestination(GrailsPageResponseWrapper.java:158) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsPageResponseWrapper$5.activateDestination(GrailsPageResponseWrapper.java:156) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsRoutablePrintWriter.activateDestination(GrailsRoutablePrintWriter.java:75) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsRoutablePrintWriter.write(GrailsRoutablePrintWriter.java:240) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer$AllocatedBuffer.writeTo(StreamCharBuffer.java:1606) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer.writeToImpl(StreamCharBuffer.java:649) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer.writeTo(StreamCharBuffer.java:612) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer.flushToConnected(StreamCharBuffer.java:1027) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer.access$1300(StreamCharBuffer.java:251) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer$StreamCharBufferWriter.flushWriter(StreamCharBuffer.java:1306) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.StreamCharBuffer$StreamCharBufferWriter.flush(StreamCharBuffer.java:1334) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.GrailsPrintWriter.flush(GrailsPrintWriter.java:171) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.buffer.GrailsPrintWriterAdapter.flush(GrailsPrintWriterAdapter.java:122) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.web.sitemesh.GrailsRoutablePrintWriter.flush(GrailsRoutablePrintWriter.java:259) ~[grails-web-sitemesh-3.0.4.jar:3.0.4]
   at java.io.FilterWriter.flush(Unknown Source) ~[na:1.8.0_51]
   at org.grails.buffer.GrailsPrintWriter.flush(GrailsPrintWriter.java:171) ~[grails-encoder-3.0.4.jar:3.0.4]
   at org.grails.taglib.encoder.OutputEncodingStack$OutputProxyWriterGroup.flushActive(OutputEncodingStack.java:167) ~[grails-taglib-3.0.4.jar:3.0.4]
   at org.grails.taglib.encoder.OutputEncodingStack$OutputProxyWriterGroup.activateWriter(OutputEncodingStack.java:160) ~[grails-taglib-3.0.4.jar:3.0.4]
   at org.grails.taglib.encoder.OutputEncodingStack$OutputProxyWriterGroup.reset(OutputEncodingStack.java:155) ~[grails-taglib-3.0.4.jar:3.0.4]
   at org.grails.taglib.encoder.OutputEncodingStack.pop(OutputEncodingStack.java:356) ~[grails-taglib-3.0.4.jar:3.0.4]
   at org.grails.gsp.GroovyPage.cleanup(GroovyPage.java:177) ~[grails-gsp-3.0.4.jar:3.0.4]
   at org.grails.gsp.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:194) ~[grails-gsp-3.0.4.jar:3.0.4]
   at org.grails.gsp.GroovyPageWritable.writeTo(GroovyPageWritable.java:109) ~[grails-gsp-3.0.4.jar:3.0.4]
   at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:72) ~[grails-web-gsp-3.0.4.jar:3.0.4]
   ... 71 common frames omitted

Grails 2.x中不会发生此错误

我怀疑Spring Boot处理所有内容甚至二进制文件

我测试过我正在下载一个zip并立即取消,也会触发此异常

如何配置不处理二进制文件或静态文件的Grails?

0 个答案:

没有答案