Solved

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

Posted on 2008-10-15
2
9,626 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
strDist challenge 35 129
wordappend challenge 8 202
what is the main difference between git clone and fetch ann pull and push commands 2 102
maven project error 5 72
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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.

830 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