[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-10-15
2
Medium Priority
?
9,717 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 150 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
A solution for Fortify Path Manipulation.
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.

872 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