File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes java.lang.NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "java.lang.NoClassDefFoundError" Watch "java.lang.NoClassDefFoundError" New topic
Author

java.lang.NoClassDefFoundError

deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
i compiled an servlet successfully
but when i run at tomcat server it shows


exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

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)
insertimage.doPost(insertimage.java:27)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)



please help what should i do?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

org/apache/commons/io/output/DeferredFileOutputStream


Is this in the classpath ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
C:\Program Files\Java\jdk1.6.0\lib\tools.jar;C:\Program Files\Java\jre1.6.0\lib\j2ee.jar;F:\SOFT\Tomcat 5.0\common\lib\servlet-api.jar;F:\SOFT\Tomcat 5.0\common\lib\commons-fileupload-1.2.1.jar


this is classpath
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Check this FAQ.


[My Blog]
All roads lead to JavaRanch
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
hi,

You need to provide the commons-io jar file, as it will provide the required class "DeferredFileOutputStream" for execution.

Thanks,

Rahul
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
C:\Program Files\Java\jdk1.6.0\lib\tools.jar;C:\Program Files\Java\jre1.6.0\lib\j2ee.jar;F:\SOFT\Tomcat 5.0\common\lib\servlet-api.jar;F:\SOFT\Tomcat 5.0\common\lib\commons-fileupload-1.2.1.jar

this is classpath

I'm fairly certain it's not. Note that Tomcat does not use the CLASSPATH environment variable.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

you need to put the jar providing the required class, inside your applications web-inf lib folder...


Regards, Prasad
SCJP 5 (93%)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Prasad Krishnegowda wrote:you need to put the jar providing the required class, inside your applications web-inf lib folder...

It's WEB-INF, not web-inf.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.NoClassDefFoundError
 
Similar Threads
Accessing a Remote EJB in Glassfish from Tomcat
ServletException
tomcat mail/session problem
where to copy classes111.zip in tomcat ?
File Upload problem w/ cos MultipartRequest