• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

does anybody know what causes this error?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am trying to implement an file upload bean. i am in the very earlt stages of the progrem and i have this error coming up:
java.lang.NoClassDefFoundError: javax/servlet/ServletRequest
the bean:
package cs318package;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.oreilly.servlet.*;
public class cs318UploadBean
{
private HttpServletRequest req = null;
private String name = null;
private String value = null;
private String type = null;
private String original=null;
private File file = null;
private String systemname=null;
public cs318UploadBean(){}
public void setRequest(HttpServletRequest request) throws IOException
{
req=request;
MultipartRequest multi =
new MultipartRequest(req, "D:/Tomcat/jakarta-tomcat-5.0.14/webapps/Ass3/tmp/", 50 * 1024,
new com.oreilly.servlet.multipart.DefaultFileRenamePolicy());
Enumeration params;
params = multi.getParameterNames();
while (params.hasMoreElements())
{
name = (String)params.nextElement();
value = multi.getParameter(name);
type = multi.getContentType(name);
file =multi.getFile(name);
original=multi.getOriginalFileName(name);
systemname=multi.getFilesystemName(name);
}
}
public String getInfo()
{
return " name value type file original systemname=" + name + value + type +file + original + systemname;
}
}
i have CLASSPATH set to :
D:\Tomcat\jakarta-tomcat-5.0.14\common\lib\servlet-api.jar;D:\Tomcat\jakarta-tomcat-5.0.14\common\lib\jsp-api.jar;D:\Tomcat\jakarta-tomcat-5.0.14\webapps\Ass3\WEB-INF\classes\cs318package\;.
IS IT A SETTING PROBLEMS ? ...PLEASE HELP ME
TINO
 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Moshe,
Are you able to compile the class? It looks like you're having problems at runtime 'cause I got it compiled OK. You may wanna add a current directory .; to your CLASSPATH.
 
moshe ufnik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Vad
thanks for replying so fast.. yes i am able to compile it and i do have a current directory in CLASSPATH ( at the end...i had posted it...please let me know if i did it wrong)
i really apriciate it if u have any other ideas..
Thanks so far
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moshe, that is obviously not a fix, but... you never know with Tomcat 5.0. OK, my CLASSPATH points to a slightly different location to look up servlet-api.jar:
C:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\lib\ext\servlet-api.jar;
Normally, it shouldn't matter, but try to move it to the JRE directory and make sure your CLASSPATH sees it.
BTW, what OS are you running?
[ November 23, 2003: Message edited by: Vad Fogel ]
 
moshe ufnik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply ! i really appriciate it.
i am running xp. at school , i am using solaris.
let me try your suggestion....
 
moshe ufnik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in the java_home i dont have a servlet-api.jar where u specified. should i copy it from the tomcat?
 
moshe ufnik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i did so...and it works
 
reply
    Bookmark Topic Watch Topic
  • New Topic