tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frans Flippo <>
Subject Subclassing DefaultServlet
Date Wed, 18 Aug 2004 12:42:06 GMT

I've added some functionality to DefaultServlet by subclassing it (i.e. 
we need to do some special processing to certain URLs, for others I will 
just call super.doGet(...)). I compiled the DefaultServlet subclass 
against Tomcat's servlets-default.jar in server/lib and deployed it in 
my web application (adding a relevant servlet mapping to my web.xml).

When I first tried it I got a ClassNotFoundException for DefaultServlet, 
probably due to the fact that the Tomcat server and the web applications 
use seperate class loaders, so our web application's class loader does 
not have a copy of DefaultServlet loaded. I had to copy several JARs 
from server/lib to my web application's WEB-INF/lib directory, including 
servlets-default.jar, which contains DefaultServlet. I'd rather just 
refer to the JARs in server/lib, though. That way I know that when the 
web application is deployed to a newer version of Tomcat, the 
DefaultServlet I'm subclassing from and the one Tomcat uses will be the 

Besides symlinking, is there any way achieve this? Can I tell tomcat to 
also include server/lib in the classpath for my webapp?

Thanks in advance,

Quinity : Your Partner In eBusiness Solution Delivery

Biltstraat 449
3572 AW Utrecht
P.O. Box 13097
3507 LB Utrecht
The Netherlands

Telephone: (+31) (0)30 2335999
Fax      : (+31) (0)30 2335998
WWW      :
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material
from any computer. Quinity is neither liable for the proper and
complete  transmission of the information contained in this
communication nor for any delay in its receipt.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message