Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
java ^ examples 8 57
Connect to IP Camera using Java 4 108
java JDK Download 7 65
micro services vs rest web services 16 48
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 …
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now