Java Mailing List Archive

http://www.junlu.com/

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

Re: Second try: Embedded Tomcat 5.0: servlet mappings added to context
after start do not work. Looking for suggestions...

Jean-Francois Arcand

2004-06-09




DJohnson@(protected):

>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.
>
>
Yes, that's the way it works.

>Is this a bug?
>
No.

>Is there some way of working around this?
>
You may want to explore JMX to add your mapping to the mapper (instead
of using the Embedded interface)
Just take a look at
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-5/resources/mbeans/tomcat5-ant.xml?rev=1.16&view=markup

> 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?
>
>
You may want to file an RFE in bugzilla. I may take a look and see if I
can add the feature ( I need to investigate first)

-- Jeanfrancois


>
>__________________________________________________________________
>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
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.