You allready gave the answer.

Tomcat is amongst other things, a servlet container and therefore needs
access to the javax.servlet.* packages. That's why it's in the common/lib,
it's crucial for tomcat to run. If you look at the startup scripts you will
notice that the jars in the tomcat/common/lib dir are added to the
classpath. The jars in the WEB-INF/lib are only added to the context. So
that really a different thing.

If you want to change the version of servlet.jar, replace it with the
version you want.

Wouter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Eryq
Sent: 29 August 2001 18:00
To: [EMAIL PROTECTED]
Subject: Why does servlet.jar break servlets?


I've noticed something which seems quite odd.

It appears that I need the javax.servlet.* classes in
order to compile my servlet, to get classes such as
javax.servlet.http.HttpServletRequest, etc.

The classes can be found in a servlet.jar included
with TDK-2.1, in common/lib.

However, it appears that servlet.jar does not need
to be in the WEB-INF/lib directory of a servlet
in order for the servlet to run.

Furthermore. I have noticed that if I put servlet.jar
in the WEB-INF/lib directory of a Tomcat4-b7 servlet
(including the "examples" servlets), it breaks them...
horribly.  I get ClassCastExceptions or worse.

I am guessing that javax.servlet is somehow
"special", and that it's the servlet container's
job to ensure that the servlet has access to it,
no matter what might be in the WEB-INF/lib directory.

I am also guessing that there might be a Servlet API 2.2
versus 2.3 issue going on.

Anyway, if anyone can shed more light on this,
I'd be very interested in understanding it a bit more.

Thanks,

Eryq

Reply via email to