File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Upload servelet issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload servelet issues" Watch "Upload servelet issues" New topic
Author

Upload servelet issues

Led Estonilo
Ranch Hand

Joined: Jan 06, 2009
Posts: 36
hi, i got a project that involves uploading file using a servlet. searching on google I found the "commons file upload " of apache. done it, added jar files.

commons-file-upload-1.2.1-bin and
commons-lang-2.4-bin.

when i first ran the application, it was successful until loading the loading of the file. when i tried to upload it, this error pops up

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
java.lang.Class.getConstructor0(Class.java:2699)
erThread.java:112)
.
.
.
java.lang.Thread.run(Thread.java:619)


so i figured that maybe i did not add the jar files to the server. i opened the server and added some jar files
(C:\Program Files\jboss-4.0.5.GA\server\default\lib) I put it there because i seen many jar files there(i think i will be scolded in this....).

i ran the application again. but this time it yielded a differend error.


java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
ph.com.mobility.projects.model.EprocUploadServlet.doPost(EprocUploadServlet.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


what does this one means? do i need to download additional jar files?

done from netbeans 6.5 and Jboss as the server.


here is the code of the file upload servlet.




Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39530
    
  27
The Commons FileUpload library needs the Commons IO library in order to work. Luckily, the Apache package names are pretty consistently named, so as you get more experienced you'll be able to see what's missing just by looking at the error message.


Ping & DNS - updated with new look and Ping home screen widget
Led Estonilo
Ranch Hand

Joined: Jan 06, 2009
Posts: 36
thank you very much. yeah it resolved the problem but a new problem arises lol. Ill post a new thread
 
wood burning stoves
 
subject: Upload servelet issues
 
Similar Threads
Filtering File Uploaded to server
File Not Found Exception when uploading
Submit multipart and form data
Uploading file with special characters in name
how to upload using html or javascript?