tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: TC4-m4 startup
Date Wed, 08 Nov 2000 18:51:32 GMT
Daniel Ritchey wrote:

> I think you missed my point ...
> I want to make project that uses the catalina core, similar to how Tomcat is
> a project that uses the catalina core.  Meaning I want to use the catalina
> stuff in my project to run servlets.  My project is not a webapp that gets
> put in the webapp dir as a war file, but is an application, like tomcat,
> that runs webapps.
>
> So just as
>
> jakarta-tomcat
>   |
>   +--conf
>   |
>   +--webapps
>
> I would like to setup something like
> myproject
>   |
>   +--conf
>   |   |
>   |   +--catalina
>   |   |
>   |   +--myproject
>   |
>   +--webapps
>
> This wouldn't violate the .war specification becasue it isn't a .war webapp.
>
> So back to my original question, how exactly do I define where the base
> web.xml file is located.
>

I think what's confusing people (it certainly did me :-) is why you care about
the global web.xml file if you aren't running a web app.

The answer is that Catalina's home directory (which you normally set via the
CATALINA_HOME environment variable, either outside or inside the startup script)
is passed in the startup script as the value of the "catalina.home" system
property.  This is used, in class org.apache.catalina.startup.ContextConfig, to
calculate the path of the global web.xml file like this:

    File file = new File(Constants.DefaultWebXml);
    if (!file.isAbsolute()) {
        file = new File(System.getProperty("catalina.home") +
            File.separator + Constants.DefaultWebXml);
    FileInputStream stream =
      new FileInputStream(file.getAbsolutePath());

where Constants.DefaultWebXml is a constant string with the value
"conf/web.xml".  This part of the path is not configurable.

NOTE:  This is *not* the only configuration file that is read from this
directory -- you will probably want to do a grep for every occurrence of the
string "catalina.home" to see where else paths are calculated (in a manner
similar to the code above) based on this value.  It's not going to be
particularly easy to accomplish your goal.

>
> I pretty much resolved to making my own catalina startup package that uses
> value from a properties file rather than hardcoded values.
>

You might look at the org.apache.catalina.startup.Embedded class, which lets you
bypasses the global configuration files and do things yourself.

>
> I hope what I mean is clear...
>
> Daniel Ritchey
>

Craig McClanahan



Mime
View raw message