• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File Upload exception using Apache Commons

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I am facing this exception, while trying to upload a file using enctype="multipart/form-data. The file is parsed and updated in database, after that i am getting this exception. It will be really helpful for me, if someone gives answer to this query.

Thanks in advance..

org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. EOF after reading only: '0' of: '717' promised bytes, out of which at least: '0' were already buffered
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:429)
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:195)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:445)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
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:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
[ January 30, 2008: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajiv R K, please check your private message for an important administrative matter.
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also as this does not appear to be Struts-specific, I've adjusted the title and moved this post to a more appropriate forum.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I remember correctly, commons/fileupload is already bundled with Struts.
Are you adding it yourself?
 
Rajiv Kasthurisamy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for moving it in the right queue.

Please find the JSP and my action class below

<html:form method="POST" action="UploadManualPostingsFilesAction.do" enctype="multipart/form-data" >
<-- some other code here--->
<tr>
<td class="formLabel"><font size="2" color="#0a82c1" align="center"> Posting File for Upload </font><font color="red"> *</td>
<td> <html:file property="theFile"/></td>

</tr>

<!-- Submitting the form -->


I am trying to retreive the file content

Action class:


protected ActionForward process(HttpServletRequest request,
HttpServletResponse response, ActionMapping mapping, ActionForm form)
{
if(request.getParameter("doActionFlag")!=null)
{
if(request.getParameter("doActionFlag").equalsIgnoreCase("UPLOADFILE"))
{
UploadManualPostingsFilesForm uploadManualPostingsFilesForm =(UploadManualPostingsFilesForm)form;

FormFile inputFile = uploadManualPostingsFilesForm.getTheFile();

// I read the file and update the database.

InputStream input = inputFile.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(input));
int failedRecordsCounter = 0;
while ((str = in.readLine()) != null)
{
// perform DB operation
}

DB operation is successfull, while trying to return to the JSP i get this exception..I am really new to Struts and file uploading i am doing for the first time.. I searched for this exception in the net..everyone asked the same question..i am not able to find the answer.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rajiv R K",

Please check your private messages.
 
Rajiv Kasthurisamy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I am getting the above exception only in IE. When i tested the same with Mozilla browser, i didn't face that issue. Can anyone help me, why is this happening in IE.
 
reply
    Bookmark Topic Watch Topic
  • New Topic