首页 新闻 会员 周边 捐助

用IE8执行下载出现ClientAbortException: java.io.IOException: Client disconnected

0
悬赏园豆:10 [已解决问题] 解决于 2014-11-28 17:16

Action代码如下:

public String downEx(){
        try {
            String path = ServletActionContext.getServletContext().getRealPath("")+"/WEB-INF/file/test.iso";
            File file = new File(path);
            response.setContentType("application/octet-stream");
            response.setHeader("Content-Disposition", "attachment;filename=test.iso" );
            //PrintWriter pw = new PrintWriter(response.getOutputStream());
            //GetData.getData(pw);
            //pw.close();
            response.setContentLength((int)file.length());
            InputStream in = new FileInputStream(file);
            OutputStream out = response.getOutputStream();
            int len = 0;
            byte[] buff = new byte[1024];
            while((len = in.read(buff))!= -1){
                out.write(buff,0,len);
            }
                out.flush();
                in.close();
                out.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        return null;
    }

打开IE8,弹出文件下载对话框。保持该对话框几分钟不动,控制台上报以下错误

严重: ClientAbortException:  java.io.IOException: Client disconnected
严重:     at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:427)
严重:     at com.sun.grizzly.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
严重:     at com.sun.grizzly.util.buf.ByteChunk.append(ByteChunk.java:355)
严重:     at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:452)
严重:     at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:439)
严重:     at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:161)
严重:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
严重:     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
严重:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
严重:     at java.lang.reflect.Method.invoke(Method.java:597)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
严重:     at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
严重:     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
严重:     at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
严重:     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
严重:     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
严重:     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
严重:     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
严重:     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
严重:     at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
严重:     at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511)
严重:     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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
严重:     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
严重:     at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:460)
严重:     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
严重:     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
严重:     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
严重:     at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
严重:     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
严重:     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
严重:     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
严重:     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
严重:     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
严重:     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
严重:     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
严重:     at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
严重:     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
严重:     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
严重:     at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
严重:     at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
严重:     at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
严重:     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
严重:     at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
严重:     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
严重:     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
严重:     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
严重:     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
严重:     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
严重:     at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
严重:     at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
严重: Caused by: java.io.IOException: Client disconnected
严重:     at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:123)
严重:     at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:73)
严重:     at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:175)
严重:     at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:208)
严重:     at com.sun.grizzly.http.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:186)
严重:     at com.sun.grizzly.http.SocketChannelOutputBuffer.realWriteBytes(SocketChannelOutputBuffer.java:150)
严重:     at com.sun.grizzly.tcp.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:864)
严重:     at com.sun.grizzly.tcp.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:155)
严重:     at com.sun.grizzly.tcp.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:620)
严重:     at com.sun.grizzly.tcp.Response.doWrite(Response.java:623)
严重:     at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:422)
严重:     ... 93 more
lanse_yan的主页 lanse_yan | 初学一级 | 园豆:187
提问于:2012-11-26 15:06
< >
分享
最佳答案
0

我也是 ie8下面报错,其他的浏览器都不报错。我把地址设置成信任站点,就没有出现过这样的问题了。

收获园豆:5
qq348827149 | 菜鸟二级 |园豆:207 | 2013-03-22 16:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册