tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <>
Subject RE: Why does servlet.jar break servlets?
Date Wed, 29 Aug 2001 15:44:25 GMT

	Any class in common/lib (on TC 3.3, lib in TC 3.2) does not, and
really can not be in the WEB-INF/lib.  The reason is that two different
class loaders load the classes, which makes them not equal and not castable,
thus the reason for the Class Cast Exceptions - your WEB-INF classes don't
extend the HttpServlet in common/lib, it  extends the HttpServlet in


> -----Original Message-----
> From: Eryq []
> Sent: Wednesday, August 29, 2001 12:00 PM
> To:
> 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

View raw message