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
James Westby - 15 Mar 2006 18:10 GMT
> Hi!
> I am trying to use Apache FileUpload to read a file and store it in a
[quoted text clipped - 15 lines]
> at _registrer__controller._jspService(registrer_controller.jsp:29)
> ...
[snip]
> So, the error comes when trying to parse the request containing a text
> file.
[quoted text clipped - 6 lines]
> Regards,
> Per Magnus
Have you also got jakarta commons io available to the jsp? This is
probably a dependency
James
kebabkongen@hotmail.com - 16 Mar 2006 10:20 GMT
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
[quoted text clipped - 31 lines]
>
> James