*
The moose likes Servlets and the fly likes File Upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File Upload" Watch "File Upload" New topic
Author

File Upload

Yu Tao
Greenhorn

Joined: Dec 12, 2004
Posts: 28
Hi I'm not sure if this is the correct place to post this, but I've seen the same problem posted elsewhere on the web and seen it left unresolved.

This is the error I get when I try just to instansiate ( DiskFileUpload d = new DiskFileUpload() ),

I've tried almost everything with it, please help!! ( ps: I'm using eclipse and jboss4, I'm pretty sure my classpaths are ok - I put the commons jar into the shared lib folder of jboss )

any help would be really appreciated.

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
fileupload.FileUpload.doPost(FileUpload.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Looks like you don't have either servlet.jar or servlet-api.jar on your classpath.

If you're using Tomcat then servlet-api.jar is in TOMCAT_HOME/common/lib


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
I noticed that you've actually posted to several other sites with the same question. Hope my answer could calm you down somewhat.

I'd suspect it is a classpath problem. As my eclipse is currently giving me some problem, I could not check if I have a classpath for servlet-api.jar or the like.

If you're in desperation (judging from the numerous sites you've posted the question, I think you are), why not add all apparent servlet jars such as servlet-api.jar from \\[jboss-4]\server\all\deploy\jbossweb-tomcat50.sar to your project classpath?

When things regain normalcy, then you could use binary elimination to elimate those jar files that have no effect ?

Caveat: Just make sure that you don't include jar files of duplicate packages that belongs to different versions. I made that mistake once, and it was very painful.

Originally posted by Yu Tao:
Hi I'm not sure if this is the correct place to post this, but I've seen the same problem posted elsewhere on the web and seen it left unresolved.

This is the error I get when I try just to instansiate ( DiskFileUpload d = new DiskFileUpload() ),

I've tried almost everything with it, please help!! ( ps: I'm using eclipse and jboss4, I'm pretty sure my classpaths are ok - I put the commons jar into the shared lib folder of jboss )

any help would be really appreciated.

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
fileupload.FileUpload.doPost(FileUpload.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


[ April 17, 2005: Message edited by: Ken Loh ]
[ April 17, 2005: Message edited by: Ken Loh ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File Upload
 
Similar Threads
out of Heap Space
Struts and File upload error - newbie
NoClassDefFoundError
JSP & Crystal Reports
problem running servlets on tomcat