File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes tomcat 4.1.18 - servlet.jar not loaded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "tomcat 4.1.18 - servlet.jar not loaded" Watch "tomcat 4.1.18 - servlet.jar not loaded" New topic
Author

tomcat 4.1.18 - servlet.jar not loaded

Rich Smyth
Ranch Hand

Joined: May 30, 2002
Posts: 87
I'm running on MS XP. On startup of tomcat 4.1.18 I get a message saying that servlet.jar can't be loaded because of the Servlet spec 2.3 section 9.7.2 (included below).
I'm new to tomcat and I'm not too familiar with classloaders.
The message from the console at startup of Tomcat 4.1.18 says:
"WebAppClassLoader: validateJarFile<C:\jakarta\jakarta-tomcat-4.1.18\
webapps\registeruser\WEB-INF\lib\servlet.jar> jar not loaded. See Servlet spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class"
The reference to registeruser is my struts webapp.
The servlet spec 2.3 section 9.7.2 says:
SRV.9.7.2 Web Application Classloader
The classloader that a container uses to load a servlet in a WAR must allow the
developer to load any resources contained in library JARs within the WAR
following normal J2SE semantics using getResource. It must not allow theWAR to
override J2SE or Java servlet API classes. It is further recommended that the loader
not allow servlets in theWAR access to the web container's implementation classes.
It is recommended also that the application class loader be implemented so
that classes and resources packaged within the WAR are loaded in preference to
classes and resources residing in container-wide library JARs.
What does this mean?
Rick
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12785
    
    5
Is this a brand new installation or did you have an earlier version of Tomcat running?
Bill
Rich Smyth
Ranch Hand

Joined: May 30, 2002
Posts: 87
This is a new installation of Tomcat. I'm trying to setup a Struts development environment on a brand new machine.
Rich
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Did you place a copy of servlet.jar inside your web application (inside WEB-INF/lib)? You usually get this error message when you do this because you're not allowed to (re)load these classes - after all they are already provided by the container.
Simon
Rich Smyth
Ranch Hand

Joined: May 30, 2002
Posts: 87
Thank you Simon. I did indeed have servlet.jar included in my webapp. Tomcat now starts up clean.
I'm working through 2 examples on how to create a webapp using struts and both of them said to include servlet.jar. Remains to be seen if these examples will now work !?
Rich
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Doh! You do need to have servlets.jar in your CLASSPATH when you compile though.
Glad it's working now...
Simon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat 4.1.18 - servlet.jar not loaded