Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Jakarta File Upload - ServletFileUpload.parseRequest - NoSuchMethodError

Reply
Thread Tools

Jakarta File Upload - ServletFileUpload.parseRequest - NoSuchMethodError

 
 
junk1@davidbevan.co.uk
Guest
Posts: n/a
 
      02-23-2006
Im trying to test a simple file upload using Jakartas package, but am
getting the following error...

SRVE0026E: [Servlet
Error]-[org/apache/commons/fileupload/servlet/ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List;]:
java.lang.NoSuchMethodError:
org/apache/commons/fileupload/servlet/ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContextLjava/util/List;

The HTML is...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE>fileupload.html</TITLE>
</HEAD>
<BODY>
<form action="/jlp_wug_WASUG/FileUploadServlet" method="post"
enctype="multipart/form-data">
<INPUT type="file" name="file" size="20">
<INPUT type="text" name="aaaaaa" size="20">
<INPUT type="submit" name="submit">
</form>
<P>Place content here.</P>
</BODY>
</HTML>

and the java is...

package com.johnlewis.wug.wasug.pres.misc;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFac tory;
import org.apache.commons.fileupload.servlet.ServletFileU pload;


public class FileUploadServlet extends HttpServlet implements Servlet {


public void doPost(HttpServletRequest aReq, HttpServletResponse aResp)
throws ServletException, IOException {

System.out.println("FILE UPLOAD");
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(aReq);
System.out.println("isMultipart:[" + isMultipart + "]");

// Create a factory for disk-based file items
DiskFileItemFactory factory = new DiskFileItemFactory();

// Set factory constraints
factory.setSizeThreshold(1000000);
factory.setRepository(new File(""));

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

// Set overall request size constraint
upload.setSizeMax(1000000);

// Parse the request
try {
List items = upload.parseRequest(aReq);

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();

if (item.isFormField()) {
System.out.println("item.getFieldName():[" + item.getFieldName() +
"]");
System.out.println("item.getString():[" + item.getString() + "]");

} else {
System.out.println("item.getFieldName():[" + item.getFieldName() +
"]");
System.out.println("item.getName():[" + item.getName() + "]");
}
}


}
catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}


Does anyone know why im getting this error?


Thanks

David Bevan
http://www.davidbevan.co.uk

 
Reply With Quote
 
 
 
 
AlexCheng1982@gmail.com
Guest
Posts: n/a
 
      02-24-2006
try re-download the commons fileupload package

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Jakarta File Upload and Apache Tomcat nushio@gmail.com Java 6 10-06-2010 11:06 PM
Lowongan : Web Programmer / Developer (Jakarta Raya – Jakarta Pusat) untung Java 0 10-07-2009 01:22 PM
Jakarta HTTPClient upload problems WinstonSmith_101@hotmail.com Java 0 11-10-2006 09:16 AM
Jakarta common/net FTP - setRestartOffset - Upload Resume... KGuru Java 4 03-23-2006 11:23 AM
jakarta commons file upload and store to mysql Joshua Java 0 10-20-2004 05:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57