tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Servlet deployment without using web.xml?!
Date Fri, 18 Jan 2002 18:00:37 GMT

On Fri, 18 Jan 2002, Thomas Åhlen wrote:

> Date: Fri, 18 Jan 2002 12:09:42 +0100
> From: Thomas Åhlen <>
> Reply-To: Tomcat Users List <>
> To:
> Subject: Servlet deployment without using web.xml?!
> This is what I want to do:
> 1. First I define one servlet(Controller) in the web.xml file
> 2. I want my Controller servlet to be able to add and remove
> servlets(modules) from the application context.
> Why? In my system each servlet is a module and I want my modules to be
> pluggable. e.g. possible to add and remove modules(servlets) thru the
> Controller servlet. Today I have to change the web.xml file and reload the
> application every module I add/remove.
> Is this possible? I would see no reason to why there couldn't be some
> interface between Tomcat and my servlet that could do this.
> Thanks for any suggestions

The "add a new servlet dynamically" part of your requirements is exactly
what the invoker servlet inside Tomcat does (/servlet/*) the first time it
sees a new request.  This requires a privileged servlet that has direct
access to the internals of Tomcat, so any solution you create based on
this will not be portable.

The "remove an existing servlet dynamically" part is much harder, because
Java provides no mechanism to remove existing classes -- the only choice
is to throw away an entire class loader.  You might look at how JSP page
compilers deal with this (they create a class loader per page), but again
you'd be off on your own with a highly customized Tomcat-specific

If you really want pluggable modules, you should consider making your
modules webapps in their own right.  Tomcat already does everything you
need for that.

> Thomas Åhlen


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message