Does anyone know how to specify a location for the default context.xml
file outside of $CATALINA_BASE/conf? I have looked through the Tomcat
source code and found a reference to the constant for the default file
name itself, "conf/context.xml," as well as getters and setters that
seem to over-ride this location and name (in
./container/catalina/src/share/org/apache/catalina/startup/ContextConfig
.java and
./container/catalina/src/share/org/apache/catalina/core/StandardContext.
java). However, after a (manual) step-through of the code, I cannot find
where any Tomcat class is calling setDefaultContextXml. Also, after
grepping every file within the source, I can find no reference to the
method outside the classes that define it. (Even if the classes are
called on reflection, some literal would have to contain a string of the
set method name itself.)
 
Because this alternative configuration need does not seem to be common,
I cannot find any reference to moving the context xml file anywhere but
the code itself. Obviously, any help would be appreciated.
 
Background Information (Why I want to do this.)
----------------------------------------------------------------------
The gist of the matter is that I am in the process of upgrading our
installation of Tomcat from 4.4 to 5.5. In our 4.x implementation, we
had configured a default context to define the jdbc connections commonly
used by our multiple webapps (we are running more than a dozen webapps
under one Tomcat JVM, basically all using the same DB connection
resources). Previously, the context element (defaultContext) was
contained within the server.xml itself, and we were able to place that
xml file in multiple paths on our system, using the "-config {path}"
option when calling startup.sh.
 
Because we run our webapps in a variety of environments (a development
environment, QC, stage and prod) -- each with its own database -- with
Tomcat 4.x, we are currently able to use multiple versions of the
server.xml, wherein the values defined for the connection parameter
correspond to its environment's database. (Basically, we have defined a
conf directory for each of our environments, like, "conf_dev" and
"conf_qa" in which we currently store server.xml; using cvs, we have
deployed the directory by checking it out as "conf," allowing us to
retrieve the server.xml with the relevant URL and password.)
 
However, I cannot find a similar solution now that context.xml takes the
place of the defaultcontext within server xml. Obviously, you are able
to define $CATALINA_BASE on startup, which ultimately would allow us to
have multiple locations for conf/context.xml, but we do not need to also
keep multiple copies of all the files under conf, logs, work, etc.
 
Putting the resources in context.xml under $CATALINA_BASE/conf is the
only successful way I have been able to retrieve JNDI resources
properly.
 
Thank you sincerely for your help,
Teresa

Reply via email to