Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Embedded Tomcat 5.0: servlet mappings added to context after start do not
work

DJohnson

2004-05-26


I have an application which embeds tomcat 4.1.12. It dynamically creates
contexts, adding wrappers for servlets, etc. Due to the dynamic nature of
this application, it can add and remove servlet mappings after the context
has been started (added into a host in the started engine). This works
fine under 4.1.12.
Now I am trying to upgrade to Tomcat 5, specifically 5.0.24, and this
fails. Servlet mappings added via context.addServletMapping() before the
context is started work fine, but servlet mappings added afterward do not
work. I've searched the archives and found no mention of this. After
some debugging of the running engine, here is what I find:
1. Initial mapping of incoming requests is now based upon a Mapper within
the CoyoteConnector, and the Mapper held within a StandardContext is no
longer consulted on a per-request basis.
2. CoyoteConnector(s) retrieve all mapping information from new contexts,
so they are initially correct.
3. Subsequently added/removed servlet mappings are maintained within the
StandardContext's Mapper, but do *not* get propagated to the Connector.

Is this a bug? Is there some way of working around this? At the time I
am adding mappings to a Context, I do not have a reference to the
associated Connector, or I could (also) tell the Connector about the
servlet mapping. Any suggestions?

__________________________________________________________________
David S. Johnson
DeskNet Inc.
66 Pearl Street, Suite 300
Portland, ME 04101
Phone: 207-772-1484 x13
FAX: 207-773-6133
http://www.desknetinc.com
Harness the Power of Your Content
©2008 junlu.com - Jax Systems, LLC, U.S.A.