commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gustavo N." <gusnes_mailingl...@yahoo.com.ar>
Subject Re: [fileupload] Can't resolve example problem
Date Fri, 21 Feb 2003 13:40:53 GMT
Hi Gaston:

        The problem is that you don´t have the byte code (.class) of a
class: java.lang.NoClassDefFoundError:
org/apache/commons/beanutils/MethodUtils
        I'm using this package with the struts framework and had no problem.
Perhaps you need other's common packages for this to work well, try with
commons-beanutils.jar (I have it because of struts)

        I hope this help you,

                                Gustavo.-

pd:  http://jakarta.apache.org/commons/fileupload/dependencies.html

----- Original Message -----
From: "Gaston Escobar" <gescobar@451.com>
To: "MAILING Common de jakarta" <commons-user@jakarta.apache.org>
Sent: Friday, February 21, 2003 10:12 AM
Subject: [fileupload] Can't resolve example problem


> I couldn't make fileupload work yet!!
>
> This is the way I'm doing it:
> I've got this .html page:
>
> <FORM ENCTYPE="multipart/form-data" ACTION="servlet/UploadServlet"
> METHOD=POST>
> <INPUT NAME="text1" TYPE="text">
> <INPUT NAME="userfile1" TYPE="file">
> <INPUT TYPE="submit" VALUE="Send File">
> </FORM>
>
> Then I've got this servlet (which is a mixture between the example of
> package.html and some
> code):
>
>
> import java.io.*;
> import java.util.*;
> import java.lang.*;
> import org.apache.commons.fileupload.*;
> import java.net.*;
> import java.sql.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class UploadServlet extends HttpServlet {
>  public void doPost(HttpServletRequest req, HttpServletResponse res)
>     {
>
> FileUpload fu = new FileUpload();
>         // maximum size before a FileUploadException will be thrown
>         fu.setSizeMax(1000000);
>         // maximum size that will be stored in memory
>         fu.setSizeThreshold(4096);
>         // the location for saving data that is larger than
> getSizeThreshold()
>         fu.setRepositoryPath("../");
>
>     try {
> System.out.println("aca1");
> List fileItems = fu.parseRequest(req);
> System.out.println("aca2");
> // assume we know there are two files. The first file is a small
> // text file, the second is unknown and is written to a file on
> // the server
> Iterator i = fileItems.iterator();
> String comment = ((FileItem)i.next()).getString();
> FileItem fi = (FileItem)i.next();
> // filename on the client
> String fileName = fi.getName();
> // save comment and filename to database ...
> // write the file
> fi.write("../" + fileName);
> }   catch(FileUploadException fue) {
>          fue.printStackTrace();
>          System.out.println("There was and error when reading and writing
> the file to the server.");
>         } catch(Exception e) {
>             e.printStackTrace();
>         }
>
>     }
> }
>
>
> The servlet throws an exception when it does: List fileItems =
> fu.parseRequest(req);
>
>
> I really don't understand what is happening,
>
>
> Tomcat's answer is the following:
>
> javax.servlet.ServletException: Servlet execution threw an exception
> at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:269)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
> ...
>
> root cause
>
> java.lang.NoClassDefFoundError: org/apache/commons/beanutils/MethodUtils
> at
>
org.apache.commons.fileupload.FileUpload.getNewInstanceMethod(FileUpload.jav
> a:669)
> at
org.apache.commons.fileupload.FileUpload.createItem(FileUpload.java:600)
> ...
>
>
>
>
>
>
>  I will really apreciate your help, Please, I need these working as soon
as
> it is possible!
> Thank you very much
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org

------------
¡Internet GRATIS es Yahoo! Conexión!
Usuario "yahoo", contraseña "yahoo". 
Desde Buenos Aires, 4004-1010.
Otras ciudades: http://conexion.yahoo.com.ar/avanzados.html

Mime
View raw message