Unable to parse request org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null

最近做一个web项目中有上传文件的功能,已经写出并在本地和部署到服务器上测试了好几个文件上传都没问题(我用的是tomcat)。部署上服务器,上传图片时有的图片大就回在tomcat日志报如下错误:

Unable to parse request
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367) [commons-fileupload-1.2.1.jar:1.2.1]
at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parseRequest(JakartaMultiPartRequest.java:189) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.processUpload(JakartaMultiPartRequest.java:127) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parse(JakartaMultiPartRequest.java:92) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.<init>(MultiPartRequestWrapper.java:81) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.Dispatcher.wrapRequest(Dispatcher.java:796) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.ng.PrepareOperations.wrapRequest(PrepareOperations.java:134) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) [struts2-core-2.3.15.1.jar:2.3.15.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.35]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.35]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.35]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) [catalina.jar:7.0.35]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.35]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.35]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) [catalina.jar:7.0.35]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) [catalina.jar:7.0.35]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.35]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.35]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) [tomcat-coyote.jar:7.0.35]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) [tomcat-coyote.jar:7.0.35]
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822) [tomcat-coyote.jar:7.0.35]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_13]
Caused by: java.io.IOException
at org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:612) [tomcat-coyote.jar:7.0.35]
at org.apache.coyote.http11.InternalAprInputBuffer$SocketInputBuffer.doRead(InternalAprInputBuffer.java:642) [tomcat-coyote.jar:7.0.35]
at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:124) [tomcat-coyote.jar:7.0.35]
at org.apache.coyote.http11.InternalAprInputBuffer.doRead(InternalAprInputBuffer.java:534) [tomcat-coyote.jar:7.0.35]
at org.apache.coyote.Request.doRead(Request.java:422) [tomcat-coyote.jar:7.0.35]
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290) [catalina.jar:7.0.35]
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:431) [tomcat-coyote.jar:7.0.35]
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315) [catalina.jar:7.0.35]
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200) [catalina.jar:7.0.35]
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977) [commons-fileupload-1.2.1.jar:1.2.1]
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:887) [commons-fileupload-1.2.1.jar:1.2.1]
at java.io.InputStream.read(InputStream.java:85) [na:1.6.0_13]
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:94) [commons-fileupload-1.2.1.jar:1.2.1]
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:64) [commons-fileupload-1.2.1.jar:1.2.1]
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:362) [commons-fileupload-1.2.1.jar:1.2.1]
... 23 common frames omitted

然后在百度和谷歌上各种搜索,大多数认为是超时而断开连接。对于解决办法一般给的不够全面,现综合给出如下:

(1)首先,上传页面上面的 form 标签要设enctype="multipart/form-data" 参数

(2)修改tomcat配置文件server.xml,找到类似于下面配置:

<Connector port="8086" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
将上面的参数disableUploadTimeout值改为false即可。

(3)上边(1)是我的程序中已经设置的,修改了(2)所述的配置后依然不能运行,后来又修改了tomcat配置文件server.xml中的另外一处:

<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> 也在里边加入了disableUploadTimeout="false"一句。

用了以上方法仍然不能解决,后来想到可能是服务器外加了防火墙或者限制了上传文件的大小之类的,联系网络中心进行相关设置进行设置即可。

资料参考:

http://www.cnblogs.com/qingxinblog/p/3437169.html

时间: 2024-10-17 00:53:45

Unable to parse request org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null的相关文章

上传文件出错:org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly

最近做一个web项目中有上传文件的功能,已经写出并在本地和部署到服务器上测试了好几个文件上传都没问题(我用的是tomcat).后来又上传了一个700多K的文件(前边的都是不足600K的,并且这个word文件用到了vb,比较复杂,可能造成读取较慢),在本地也是可以的,部署到服务器后在服务器上用服务器的本地浏览器上传也是可以的,但是部署到服务器上在其他地方通过浏览器访问上传却不行,情况是运行很久,然后出现“不能显示此页面”的字样.我就很奇怪,为什么同样的程序在本地和服务器上的效果却是不一样的?我看了

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected be

1.错误描写叙述 八月 14, 2015 3:03:05 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn 警告: Request exceeded size limit! org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (13463244) exc

CVE-2014-0050: Exploit with Boundaries, Loops without Boundaries、Apache Commons FileUpload and Apache Tomcat DoS

catalog 1. Description 2. Analysis 3. POC 4. Solution 1. Description MultipartStream.java in Apache Commons FileUpload before 1.3.1, as used in Apache Tomcat, JBoss Web, and other products, allows remote attackers to cause a denial of service (infini

Apache Commons FileUpload

1    概述 Commons FileUpdate包很容易为你的Servlet和web应用程序添加健壮的.高性能的文件上传功能.FileUpload解析遵循RFC 1876(在HTML中基于表单的文件上传)HTTP请求.即,如果一个HTTP请求使用POST方法提交,并且使用"multipart/form-data"的内容类型,然后FileUpload解析请求,使结果易于调用者使用.从1.3开始,FileUpload处理RFC 2047编码头值. 2    用户指南 2.1    使用

文件上传之Apache commons fileupload使用

文件上传的方法主要目前有两个常用的,一个是SmartUpload,一个是Apache的Commons fileupload. 我们这里主要介绍下第二个的用法,首先要上传文件,注意几个问题: 1 form表单内,要添加空间<input type="file" name="myfile"> 2 form表单的内容格式要定义成multipart/form-data格式 3 需要类库:1 commons-io.jar 2commons-fileupload-1.

org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException

1.错误原因 org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null at org.apache.commons.fileupload.FileUploadBase$FileItemIterator

Apache Commons fileUpload实现文件上传之一

  需要两个jar包: commons-fileupload.jar Commons IO的jar包(本文使用commons-io-2.4.jar) 利用Servlet来实现文件上传. package web.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http

Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.RequestContext

1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2014-7-10 23:23:53 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.29 using

Apache Commons FileUpload实现文件上传

Commons FileUpload简介 Apache Commons是一个专注于可重用Java组件开发的 Apache 项目.Apache Commons项目由三个部分组成: 1.Commons Proper - 可重用Java组件的存储库. 2.The Commons Sandbox - 用于Java组件开发的工作区. 3.The Commons Dormant - 当前不活动的组件存储库. Commons-FileUpload是Commons Proper中的一个组件,该组件依赖于Comm