You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Paul Singleton <p....@keele.ac.uk> on 2000/04/07 16:10:26 UTC
how does a tomcat find its way home
I couldn't find any documentation on how the
org.apache.tomcat.shell.Startup
classes find the Tomcat home directory, and I assume they use the
working directory of the JVM task/process?
I'm loading Tomcat into a JVM which has been started (via Invocation
API) as a shared library by another process, and I currently get this
to work by cd-ing to the home dir first...
Is there a way to specify this as a parameter to Startup.main() or
whatever?
cheers - Paul Singleton
Context's between Tomcat & Apache
Posted by Brill Pappin <br...@jmonkey.com>.
Its a real pain to get the context's working with their servlet containers
etc... however, when you use the simple HTTP server included in Tomcat...
everything just *works*.
Could we not have the connector read the server.xml file (something like
JRun) and set itself up so you don't need to include all those links etc. ??
- Brill Pappin
Re: how does a tomcat find its way home
Posted by Jun Inamori <j-...@osa.att.ne.jp>.
Hello Paul,
I'm not sure about
org.apache.tomcat.shell.Startup
but as for Tomcat3.1Beta,
org.apache.tomcat.startup.Tomcat
is responsible for all the initialization tasks, such as obtaining
Tomcat home directory.
And Tomcat home directory can be known by the following procedure:
1. main method of org.apache.tomcat.startup.Tomcat calls
execute(String[]) method on itself.
2. execute(String[]) method of org.apache.tomcat.startup.Tomcat calls
getHome() method of org.apache.tomcat.core.ContextManager.
3. getHome() method of ContextMethod calls setHome(".") on itself. (Note
that the argument to this method is ".") During setHome("."),
"tomcat.home" system property is examined, and if it is set, the
directory specified by "tomcat.home" is treated as 'Temporary' Tomcat
home directory. If it is not set, the current directory(".") is treated
as 'Temporary' Tomcat home directory.
4. execute(String[]) method of Tomcat read the "conf/server.xml" file
under the 'Temporary' Tomcat home directory retrieved in the previous
step. This is done by xh.readXML(File,ContextManager), where "xh" is the
instance of org.apache.tomcat.util.xml.XmlMapper.
5. xh.addRule("ContextManager",xh.setProperties()) is executed before
xh.readXML(File,ContextManager). This means that all the attributes of
the "ContextManager" element in the "server.xml" file are set by the
corresponding setXXX methods. For example, if the "server.xml" file
contains the element of <ContextManager home="/usr/local/tomcat"
workDir="/var/tomcat">,
cm.setHome("/usr/local/tomcat");
cm.setWorkDir("/var/tomcat");
are invoked during readXML(File f,ContextManager cm).
Thus 'Temporary' Tomcat home directory can be overwritten by
CURRENT_DIRECTORY/conf/server.xml
or
TOMCAT_HOME/conf/server.xml
In your case, it seems that environment variable of TOMCAT_HOME is not
passed to JVM. But you can pass it by the command line argument to JVM,
not the class.
It looks like
java -Dtomcat.home=/usr/local/tomcat org.apache.tomcat.startup.Tomcat
I'm not sure what "a shared library" refer to. In case you start Tomcat
by the JServ module at the boot of Apache, jserv.properties file can
specify the command line argument to JVM, such as
wrapper.bin.parameters=/usr/local/tomcat
I hope this will help you.
Happy Java programming!
Jun Inamori
E-mail: j-office@osa.att.ne.jp
URL: http://www.oop-reserch.com
Paul Singleton wrote:
>
> I couldn't find any documentation on how the
>
> org.apache.tomcat.shell.Startup
>
> classes find the Tomcat home directory, and I assume they use the
> working directory of the JVM task/process?
>
> I'm loading Tomcat into a JVM which has been started (via Invocation
> API) as a shared library by another process, and I currently get this
> to work by cd-ing to the home dir first...
>
> Is there a way to specify this as a parameter to Startup.main() or
> whatever?