我在使用gwt上传文件时遇到以下异常,而上传小文件时一切正常< 2MB当我尝试上传>文件时出现此错误2MB文件
2014-02-07 01:40:55 UploadServlet [INFO] UPLOAD-SERVLET init: maxSize=26214400, slowUploads=0, isAppEngine=false
2014-02-07 01:40:55 UploadListener [INFO] UploadListener created new instance. (slow=0, requestSize=13573900)
2014-02-07 01:41:58 UploadServlet [ERROR] UPLOAD-SERVLET (7B84E73710BCF20B106DE08C644D0EF3.qtc02) Unexpected Exception -> Processing of multipart/form-data request failed. Socket read failed
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Socket read failed
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:371)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at gwtupload.server.UploadServlet.parsePostRequest(UploadServlet.java:796)
at gwtupload.server.UploadAction.doPost(UploadAction.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Socket read failed
at org.apache.coyote.ajp.AjpAprProcessor.read(AjpAprProcessor.java:328)
at org.apache.coyote.ajp.AjpAprProcessor.readMessage(AjpAprProcessor.java:424)
at org.apache.coyote.ajp.AjpAprProcessor.receive(AjpAprProcessor.java:383)
at org.apache.coyote.ajp.AbstractAjpProcessor.refillReadBuffer(AbstractAjpProcessor.java:657)
at org.apache.coyote.ajp.AbstractAjpProcessor$SocketInputBuffer.doRead(AbstractAjpProcessor.java:1135)
at org.apache.coyote.Request.doRead(Request.java:422)
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:449)
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315)
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976)
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
at java.io.InputStream.read(InputStream.java:101)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:366)
... 25 more
这是我的server.xml文件的配置
<Connector executor="tomcatThreadPool" port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
scheme="https" secure="true" connectionTimeout="40000" connectionUploadTimeout="36000000" disableUploadTimeout="false" bufferSize="4096" acceptCount="250" clientAuth="false" sslProtocol="TLS"
/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" secure="true" executor="tomcatThreadPool"
enableLookups="false" acceptCount="250" connectionTimeout="40000" packetSize="21000" redirectPort="8443" bufferSize="4096" />
我的web.xml上传参数是: -
<context-param>
<!-- max size of the upload request -->
<param-name>maxSize</param-name>
<param-value>26214400</param-value>
</context-param>
答案 0 :(得分:0)
您还需要将此添加到您的web.xml。大小是八位字节
<context-param>
<param-name>maxSize</param-name>
<param-value>100000</param-value>
</context-param>