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

K

kebabkongen

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
 
J

James Westby

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
 
K

kebabkongen

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

-Per Magnus

James Westby skrev:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top