【问题标题】:Error: Connection close: Read failed. Possible end of stream encountered错误:连接关闭:读取失败。可能遇到流的结尾
【发布时间】:2015-01-12 17:19:24
【问题描述】:

我尝试通过我的网络应用程序上传文件并收到以下消息: 连接关闭:读取失败。可能遇到流结束。

多次观察到这种行为, 在 tomcat6 Web 服务器上工作,而在 WebSphere 上连续失败, 这让我认为问题应该出在后端,而不是浏览器端。 这是错误信息:

org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Connection close: Read failed.  Possible end of stream encountered. 
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBaseo.java:359)
    at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3815)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:558)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:985)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1074)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
Caused by: java.io.IOException: Connection close: Read failed.  Possible end of stream encountered. 
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:727)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.processWork(WorkQueueManager.java:342)
    at com.ibm.ws.tcp.channel.impl.NioTCPReadRequestContextImpl.processSyncReadRequest(NioTCPReadRequestContextImpl.java:75)
    at com.ibm.ws.tcp.channel.impl.TCPReadRequestContextImpl.read(TCPReadRequestContextImpl.java:111)
    at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.fillABuffer(HttpServiceContextImpl.java:4175)
    at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.readSingleBlock(HttpServiceContextImpl.java:3407)
    at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.readBodyBuffer(HttpServiceContextImpl.java:3513)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundServiceContextImpl.getRequestBodyBuffer(HttpInboundServiceContextImpl.java:1791)
    at com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream.bufferIsGood(WCCByteBufferInputStream.java:371)
    at com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream.read(WCCByteBufferInputStream.java:265)
    at com.ibm.ws.webcontainer.srt.http.HttpInputStream.read(HttpInputStream.java:322)
    at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:959)
    at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:887)
    at java.io.InputStream.read(InputStream.java:82)
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:94)
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:64)
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:354)
    ... 27 more

【问题讨论】:

    标签: java file-upload websphere tomcat6 java-io


    【解决方案1】:

    根据此处有限的信息,很难确定原因。常见的嫌疑人会在请求的持续时间内达到时间限制,或者开始响应 IBM HTTP Server 中的 WebSphere 插件(如果正在使用);或者可能是上传的大小。

    这里没什么可说的了。

    【讨论】:

    • 堆栈跟踪没有显示任何配置选项。发布整个堆栈,相关来源。
    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 2016-07-15
    • 1970-01-01
    • 1970-01-01
    • 2021-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多