• 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

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

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic