`
tristan_wang
  • 浏览: 166749 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Failed to parse multipart request

    博客分类:
  • J2EE
阅读更多
> -----Original Message-----
> From: Sharma, Kamlesh [RA] [mailto:KAMLESH.SHARMA@saic.com]
> Sent: Wednesday, April 28, 2004 1:37 PM
> To: commons-user@jakarta.apache.org
> Subject: Re:File upload exception
>
>
> Hi, All
>
> I am receiving following exception, while uploading the file
> using struts. I
> am
> using Weblogic 8.1 server. However, I am able to process the file and the
> server is throwing this exception. Kindly help, thanks in advance.

You cannot use the getParameter() family of calls if you're using FileUpload
to parse the request. It would appear that you are trying to use both to
process the same request, which isn't going to work. If you're using
FileUpload to parse a multipart request, you'll need to make sure you don't
call any of the getParameter() family of methods.
--
Martin Cooper


>
> <Apr 27, 2004 10:05:41 AM EDT> <Warning> <HTTP> <BEA-101138>
> <ServletContext(id=
> 4404549,name=R1,context-path=/R1) One of the getParameter family
> of methods
> call
> ed after reading from the ServletInputStream. Not merging post
> parameters.>
> <2004-04-27 09:46:31,972> [ERROR]  - Failed to parse multipart request
> (CommonsM
> ultipartRequestHandler.java:241)
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-
> data request failed. EOF after reading only: '0' of: '1230'
> promised bytes,
> out
> of which at least: '0' were already buffered
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadB
> ase.java:429)
>         at
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1053)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:387)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:305)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:6291)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
> dSubject.java:317)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
> 97)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3575)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2573)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
> <2004-04-27 09:46:31,972> [ERROR]  - Failed to parse multipart request
> (CommonsM
> ultipartRequestHandler.java:241)
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-
> data request failed. EOF after reading only: '0' of: '1230'
> promised bytes,
> out
> of which at least: '0' were already buffered
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadB
> ase.java:429)
>         at
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1053)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:387)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:305)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:6291)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
> dSubject.java:317)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
> 97)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3575)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2573)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
> <Apr 27, 2004 9:46:31 AM EDT> <Error> <HTTP> <BEA-101017>
> <[ServletContext(id=44
> 04549,name=R1,context-path=/R1)] Root cause of ServletException.
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-
> data request failed. EOF after reading only: '0' of: '1230'
> promised bytes,
> out
> of which at least: '0' were already buffered
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadB
> ase.java:429)
>         at
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1053)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:387)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:305)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:6291)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
> dSubject.java:317)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
> 97)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3575)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2573)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
> >
> <2004-04-27 10:05:18,974> [INFO ]  - Find SQL:SELECT orgID,
> orgContactInfoID, ah
> aID, cmsID, compFollowed, deactReason, denialCmt, enrollNum, exemptOrg,
> facility
> , facType, groupType, groupTypeOth, holdCmt, jPasswrd, medID, modifyUser,
> name,
> orgAdmUsername, status FROM Organization
>  (OrganizationDAOImpl.java:311)
> <Apr 27, 2004 10:05:41 AM EDT> <Warning> <HTTP> <BEA-101138>
> <ServletContext(id=
> 4404549,name=R1,context-path=/R1) One of the getParameter family
> of methods
> call
> ed after reading from the ServletInputStream. Not merging post
> parameters.>
> <2004-04-27 10:05:42,207> [ERROR]  - Failed to parse multipart request
> (CommonsM
> ultipartRequestHandler.java:241)
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-
> data request failed. EOF after reading only: '0' of: '1412'
> promised bytes,
> out
> of which at least: '0' were already buffered
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadB
> ase.java:429)
>         at
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1053)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:387)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:305)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:6291)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
> dSubject.java:317)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
> 97)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3575)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2573)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
> <2004-04-27 10:05:42,207> [ERROR]  - Failed to parse multipart request
> (CommonsM
> ultipartRequestHandler.java:241)
> org.apache.commons.fileupload.FileUploadException: Processing of
> multipart/form-
> data request failed. EOF after reading only: '0' of: '1412'
> promised bytes,
> out
> of which at least: '0' were already buffered
>         at
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadB
> ase.java:429)
>         at
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:233)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1053)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:387)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:305)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:6291)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
> dSubject.java:317)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
> 97)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3575)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2573)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
>
> Regards
> Kam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
分享到:
评论
2 楼 511754646 2011-04-24  
兄弟你这个问题解决了么?我现在也遇到类似问题,如果搞掂了请联系联系,谢谢了!!!QQ:511754646 
本人问题:web项目,tomcat上上传功能OK的,项目迁移到weblogic10中以后,文件能上传,但是会报类似你帖的那个问题。请求帮助ing!!!!
1 楼 blgaici1 2010-11-09  
    

相关推荐

    SpringBoot+fileUpload获取文件上传进度

    throw new MultipartException("Failed to parse multipart servlet request", e); } } } 第四步:配置 CustomMultipartResolver 最后,我们需要将 CustomMultipartResolver 配置到SpringBoot应用程序中。在...

    java实现文件上传

    throw new ServletException("Failed to parse multipart request.", e); } } else { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Request does not contain multipart content."); } } } ``` ...

    Springboot上传图片

    org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util....

    详解SpringMVC使用MultipartFile实现文件的上传

    @RequestMapping(value = "/upload", method = {RequestMethod.GET, RequestMethod.POST}) public void upload(HttpServletRequest request) { MultipartHttpServletRequest multipartRequest = ...

    《Java 上传接口类》

    log.error("Failed to parse upload request", e); } } ``` 在这个例子中,我们创建了一个`ServletFileUpload`实例,然后遍历每个文件项,处理文件流,并保存文件。 **3. 文件上传的最佳实践** - **错误处理**...

    利用org.apache.commons.fileupload上传多个文件

    List&lt;FileItem&gt; items = upload.parseRequest(request); Iterator&lt;FileItem&gt; iter = items.iterator(); while (iter.hasNext()) { FileItem item = iter.next(); if (item.isFormField()) { // 处理普通表单...

    struts框架文件上传

    log.error("Failed to parse upload request", e); return mapping.findForward("error"); } for (FileItem item : items) { if (!item.isFormField()) { // 处理文件项 String fileName = item.getName(); ...

    java、jsp、servlet文件上传

    throw new ServletException("Failed to parse upload request", e); } } } ``` 这段代码中,我们首先检查请求是否为多部分/表单类型,然后使用`ServletFileUpload`解析请求并获取文件项。每个`FileItem`代表一...

    Java中,当表单含有文件上传时,提交数据的如何读取(吐血版)

    throw new ServletException("Failed to parse request", e); } } ``` 上述代码中,我们首先创建了`DiskFileItemFactory`实例来处理文件项,然后使用`ServletFileUpload`解析请求中的所有文件项。对于每个非...

    java上传控件

    在Servlet规范中,`HttpServletRequest`对象提供了处理多部分请求(Multipart Request)的能力,这是文件上传的基础。首先,需要在`doPost`方法中解析请求,然后获取上传的文件。以下是一个简单的示例: ```java //...

    java上传文件源码-Beat-Box-Machine:BeatBoxMachine,带有聊天和文件上传功能。本书“HeadFirstJava

    throw new ServletException("Failed to parse upload request", e); } } } ``` 在这个例子中,我们首先检查请求的内容类型是否为multipart/form-data,然后使用`ServletFileUpload`解析请求并获取每个文件项。...

    文件上传jar包

    List&lt;FileItem&gt; items = upload.parseRequest(request); for (FileItem item : items) { if (!item.isFormField()) { String fileName = item.getName(); File storeLocation = new File(uploadDirectory, ...

    form文件上传demo

    throw new ServletException("Failed to process file upload", e); } } else { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "File upload not supported"); } } } ``` 以上就是使用Apache ...

    java 文件上传

    return "You failed to upload file because it was empty!"; } return "You successfully uploaded file!"; } ``` ### 4. **安全性** - **文件大小限制**:为了防止DoS攻击,应限制上传文件的大小。可以在...

    HarmonyOS应用开发-图片文件上传错误交流.docx

    MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png"); // 构建multipart请求体 RequestBody body = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("parms", parms) ....

Global site tag (gtag.js) - Google Analytics