Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError

 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org/apache/commons/io/output/DeferredFileOutputStream


Is this in the classpath ?
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this FAQ.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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

Thanks,

Rahul
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to put the jar providing the required class, inside your applications web-inf lib folder...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic