wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat is refusing to load servlet.jar. Why?? 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 » Products » Tomcat
Bookmark "Tomcat is refusing to load servlet.jar. Why??" Watch "Tomcat is refusing to load servlet.jar. Why??" New topic
Author

Tomcat is refusing to load servlet.jar. Why??

ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
Hi fellow ranchers. I'm having this problem with Tomcat 4.1.18 refusing to load up the sevlet.jar file at server start-up. I put the file in the lib directory of the web application as I've done always. I've even swapped different versions of the servlet.jar file but Tomcat simply rejects it. Here is what gets printed out on the standard output (DOS Window) when I start Tomcat:
Feb 15, 2003 11:55:04 PM org.apache.commons.modeler.Registry loadRegistry
INFO: Loading registry information
Feb 15, 2003 11:55:04 PM org.apache.commons.modeler.Registry getRegistry
INFO: Creating new Registry instance
Feb 15, 2003 11:55:05 PM org.apache.commons.modeler.Registry getServer
INFO: Creating MBeanServer
Feb 15, 2003 11:55:07 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.18
WebappClassLoader: validateJarFile(C:\Ernie's Data\JSP\PROJECTS\ernieboy\WEB-INF
\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offendi
ng class: javax/servlet/Servlet.class
Feb 15, 2003 11:55:16 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
Feb 15, 2003 11:55:16 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Feb 15, 2003 11:55:16 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=10/60 config=C:\user_data\Tomcat 4118WinXp\conf\jk2.
properties

Please look at lines 11-14 of the output. When i read the mentioned Servlet 2.3 section I'm still none the wiser. Please shed some light. I'm on a Windows XP Pro box.


In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

It's not a requirement that you put servlet.jar in your WEB-INF folder. You should think of servlet.jar as something your container requires, not necessarily your application.

Older versions of Tomcat might not have cared, but with the newest version it might enforce this rule. So just try deploying without servlet.jar in your WEB-INF/lib folder.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I've looked up 9.7.2 and here is the relevant part:

It (the classloader; that is, the container) must not allow the WAR to
override J2SE or Java servlet API classes. It is further recommended that the loader
not allow servlets in the WAR access to the web container�s implementation classes.


So by trying to load servlet.jar within your webapp, you are trying to override the Java servlet API classes, which is forbidden in the spec.
ernest fakudze
Ranch Hand

Joined: Aug 27, 2001
Posts: 216
Thank you very much Mike. I will try and run my servlets without loading the servlet.jar file. In any case, there is already a servlet.jar file which comes with Tomcat 4.1.18 and it's under TOMCAT_HOME\common\lib and I guess this is the file I'm overriding when loading my own file in my web app.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat is refusing to load servlet.jar. Why??
 
Similar Threads
mysql connection on net with tomcat
jk2 in tomcat + iis configuration
Cannot start Tomcat as a service
Problems deploying the application on Tomcat 4.0.1
Tomcat Configuration -Help pls