You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Arieh Markel <Ar...@Central.Sun.COM> on 2000/03/01 02:57:40 UTC

Problem with current mechanism for initialization of Contexts

I have begun the task of migrating from shell/Startup style
to startup/Tomcat style initialization.

The problem I am trying to resolve is as follows:

   . The DocBase for my contexts needs to be determined at run-time
   
My solution involves parsing the server.xml file, and then replacing
the DocBase of the various contexts, as well as the 'home' for the
ContextManager,

Only after the replacement, do I call the ContextManager.init() method.

---

Execution tracing indicates the following:

  DefaultCMSetter.java tries to add the context after the XML handling,
  prior to init.
  
  However, this gets done before the DocBase has been modified. In the
  addContext, the existence of WEB-INF/classes is checked.
  
  In our deployment, the docBase stated in the web.xml is a temporary one
  that has the 'true' docRoot prepended to it, to form the run-time
  location. 
  
---

Example:


   <Context path="" docBase="console" debug="1" reloadable="true" />        
   <Context path="/services" docBase="services" debug="1" reloadable="true" />

The docBase is transformed to be:

	/etc/opt/SUNWesm/www/console
and
	/etc/opt/SUNWesm/www/services
	
at invocation time depending on a command-line switch.

---

With the current implementation, the check for existence of the in
DefaultCMSetter needs to be delayed until the invocation of the
ContextManager init method.

In essence, the mechanism does not account for the possibility of
setting the docbase on the context to something other than what was
found on the server.xml.

---

I have the impression that other implementors may run into similar problems.

---

Any ideas of how to smartly split the process ?

Thanks,

Arieh
--
 Arieh Markel		                Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)