Solved

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

Posted on 2008-10-15
2
9,653 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

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 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…
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.

724 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