Solved

java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

Posted on 2008-10-15
2
9,593 Views
Last Modified: 2013-11-24
When I run a website on localhost to upload an image, the servlet threw 2 exceptions:

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)
      com.ptc.smsfinder.Registratoin_Step4_Submit.doPost(Registratoin_Step4_Submit.java:41)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
      java.lang.ClassLoader.loadClassInternal(Unknown Source)
      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)
      com.ptc.smsfinder.Registratoin_Step4_Submit.doPost(Registratoin_Step4_Submit.java:41)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I use tomcat 6.0 and jdk1.6 and MyEclipse

I included commons-fileupload-1.2.1.jar in the project.

and

import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.*;
import org.apache.commons.fileupload.disk.*;
0
Comment
Question by:techques
2 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 50 total points
ID: 22719209
this is classpath issue ;
put this commons-fileupload-1.2.1.jar  file tomcat/common/lib folder.
0
 

Author Comment

by:techques
ID: 22721617
It also needs commons-io.jar file
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question