4
我正在使用struts2來導出一個excel文件。較小的文件工作正常。我得到一個更大的文件下面的錯誤。爲什麼我得到這個錯誤?該文件的大小是否過大?在500之前承諾,java.lang.IllegalStateException:承諾
2012-12-01 09:51:29.689::WARN: Committed before 500 Unable to show problem report: java.lang.IllegalStateException: STREAM
2012-12-01 09:51:29.690::WARN: /strutsDemo/process/excel:
java.lang.IllegalStateException: Committed
at org.mortbay.jetty.Response.resetBuffer(Response.java:853)
at org.mortbay.jetty.Response.reset(Response.java:832)
at org.mortbay.jetty.Response.sendError(Response.java:220)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:801)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:519)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
at org.mortbay.jetty.Server.handle(Server.java:269)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:687)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
2012-12-01 09:51:29.691::WARN: /strutsDemo/file/export
java.lang.IllegalStateException: Committed
at org.mortbay.jetty.Response.resetBuffer(Response.java:853)
at org.mortbay.jetty.Response.reset(Response.java:832)
at org.mortbay.jetty.Response.sendError(Response.java:220)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:801)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:519)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
at org.mortbay.jetty.Server.handle(Server.java:269)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:687)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
這裏是我的操作配置:
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel</param>
<param name="inputName">excelStream</param>
<param name="contentDisposition">attachment;fileName="${fileName}"</param>
<param name="bufferSize">2048</param>
</result>
<result name="invalid.token">/error.jsp</result>
</action>
沒有足夠的信息,提供詳細信息你在做什麼如何試圖導出文件,否則很難說,與第一眼看來,它似乎是流過早關閉。 –
你是如何收到這個文件的?你能告訴我們這個動作的代碼嗎,你沒有使用註釋嗎?你能告訴我們爲它定義配置的xml嗎?我可以找到這個問題的一個原因是當HttpServletResponse被提交兩次,根據這個答案:http://stackoverflow.com/questions/4162977/google-app-engine-java-lang-illegalstateexception-committed-error唯一的情況它可以想到可能帶有自定義結果類型。 – Quaternion
向我們展示您的動作配置。 –