You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Hemminger <sh...@intertrust.com> on 2001/09/05 21:39:14 UTC

Finding config files in Tomcat 4.0/Catalina

What is the proper way to find configuration files in Tomcat 4.0?

With Tomcat-3.x our server used java.lang.getResourceAsStream to retrieve
the configuration files from any location defined in the CLASSPATH.  A
common method was to put configuration files in $TOMCAT_HOME/classes.

This doesn't work on 4.0 for two reasons. First, it appears to reset the
CLASSPATH when started, second the default class loader behaviour seems to
have changed.

Stephen Hemminger 
InterTrust Technologies 
(503)-889-1348
shemminger@InterTrust.com 


Re: Finding config files in Tomcat 4.0/Catalina

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 5 Sep 2001, Steve Hemminger wrote:

> Date: Wed, 5 Sep 2001 12:39:14 -0700
> From: Steve Hemminger <sh...@intertrust.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: "'tomcat-user@jakarta.apache.org'" <to...@jakarta.apache.org>
> Subject: Finding config files in Tomcat 4.0/Catalina
>
> What is the proper way to find configuration files in Tomcat 4.0?
>
> With Tomcat-3.x our server used java.lang.getResourceAsStream to retrieve
> the configuration files from any location defined in the CLASSPATH.  A
> common method was to put configuration files in $TOMCAT_HOME/classes.
>

I assume you really mean java.lang.ClassLoader.getResourceAsStream(),
right?

> This doesn't work on 4.0 for two reasons. First, it appears to reset the
> CLASSPATH when started,

That's true ... anything already on your CLASSPATH is totally ignored.
Having answered TOMCAT-USER questions for a couple of years, I've come to
the conclusion that class paths cause a very large percentage of the
total newbie startup problems (exceeded only by problems configuring the
Apache connector).  Once people understand how Tomcat 4 does things, these
questions and problems go away.

> second the default class loader behaviour seems to
> have changed.
>

If you want to be able to continue to use this call, simply put your
resources (unpacked) under $CATALINA_HOME/classes, or in JAR files under
$CATALINA_HOME/lib, or inside your webapp (under /WEB-INF/classes or in a
JAR file under /WEB-INF/lib).  All of these locations are automatically
made visible for resource loading, as well as class loading.

> Stephen Hemminger
> InterTrust Technologies
> (503)-889-1348
> shemminger@InterTrust.com
>
>

Craig