Apache FileUpload - java.lang.NoClassDefFoundError: org/apache/commons/io/FileCleaner

Discussion in 'Java' started by kebabkongen@hotmail.com, Mar 15, 2006.

  1. Guest

    Hi!
    I am trying to use Apache FileUpload to read a file and store it in a
    Oracle Database.
    I have made a JSP page (page1) witch has a form for submitting the file
    to another JSP page (page2) for processing it.
    When submitting the form with a file, I get this error:
    ***
    500 Internal Server Error
    java.lang.NoClassDefFoundError: org/apache/commons/io/FileCleaner
    at
    org.apache.commons.fileupload.disk.DiskFileItem.getTempFile(DiskFileItem.java:579)
    at
    org.apache.commons.fileupload.disk.DiskFileItem.getOutputStream(DiskFileItem.java:519)
    at
    org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:369)
    at
    org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
    at _registrer__controller._jspService(registrer_controller.jsp:29)
    ....
    ***
    This is the code from the JSP prosessing page (page2) that fails:
    ***
    ....
    <body>
    <%
    // Check that we have a file upload request
    FileItemFactory factory;
    ServletFileUpload upload;
    int antall = 0;


    boolean isMultipart = FileUpload.isMultipartContent(request);
    if (isMultipart) {
    // Create a factory for disk-based file items
    try {
    factory = new DiskFileItemFactory();

    // Create a new file upload handler
    upload = new ServletFileUpload(factory);

    // Parse the request
    /* The Program fails right here! */
    java.util.List /* FileItem */ items =
    upload.parseRequest(request);
    .....
    ****
    So, the error comes when trying to parse the request containing a text
    file.
    It seems as if it is complaining about
    org/apache/commons/io/FileCleaner which is apparently missing, but
    FileUpload project doesn't say anything about this package.

    Any ideas what could be wrong?

    Regards,
    Per Magnus
    , Mar 15, 2006
    #1
    1. Advertising

  2. James Westby Guest

    wrote:
    > Hi!
    > I am trying to use Apache FileUpload to read a file and store it in a
    > Oracle Database.
    > I have made a JSP page (page1) witch has a form for submitting the file
    > to another JSP page (page2) for processing it.
    > When submitting the form with a file, I get this error:
    > ***
    > 500 Internal Server Error
    > java.lang.NoClassDefFoundError: org/apache/commons/io/FileCleaner
    > at
    > org.apache.commons.fileupload.disk.DiskFileItem.getTempFile(DiskFileItem.java:579)
    > at
    > org.apache.commons.fileupload.disk.DiskFileItem.getOutputStream(DiskFileItem.java:519)
    > at
    > org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:369)
    > at
    > org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
    > at _registrer__controller._jspService(registrer_controller.jsp:29)
    > ...

    [snip]
    > So, the error comes when trying to parse the request containing a text
    > file.
    > It seems as if it is complaining about
    > org/apache/commons/io/FileCleaner which is apparently missing, but
    > FileUpload project doesn't say anything about this package.
    >
    > Any ideas what could be wrong?
    >
    > Regards,
    > Per Magnus
    >

    Have you also got jakarta commons io available to the jsp? This is
    probably a dependency


    James
    James Westby, Mar 15, 2006
    #2
    1. Advertising

  3. Guest

    Thank you, James!
    That did the trick... ;-)

    -Per Magnus

    James Westby skrev:

    > wrote:
    > > Hi!
    > > I am trying to use Apache FileUpload to read a file and store it in a
    > > Oracle Database.
    > > I have made a JSP page (page1) witch has a form for submitting the file
    > > to another JSP page (page2) for processing it.
    > > When submitting the form with a file, I get this error:
    > > ***
    > > 500 Internal Server Error
    > > java.lang.NoClassDefFoundError: org/apache/commons/io/FileCleaner
    > > at
    > > org.apache.commons.fileupload.disk.DiskFileItem.getTempFile(DiskFileItem.java:579)
    > > at
    > > org.apache.commons.fileupload.disk.DiskFileItem.getOutputStream(DiskFileItem.java:519)
    > > at
    > > org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:369)
    > > at
    > > org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
    > > at _registrer__controller._jspService(registrer_controller.jsp:29)
    > > ...

    > [snip]
    > > So, the error comes when trying to parse the request containing a text
    > > file.
    > > It seems as if it is complaining about
    > > org/apache/commons/io/FileCleaner which is apparently missing, but
    > > FileUpload project doesn't say anything about this package.
    > >
    > > Any ideas what could be wrong?
    > >
    > > Regards,
    > > Per Magnus
    > >

    > Have you also got jakarta commons io available to the jsp? This is
    > probably a dependency
    >
    >
    > James
    , Mar 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page