The catalina.properties file is the one that defines the classloader
search order. So you are free to make the order fit your own needs.
For instance if you really like to share product installations and want
to add instance specific things to the common loader, you would add a
folder of your choice or a "*.jar" pattern inside CATALINA_BASE to the
common.loader in catalina.properties.
If there is a conflict between the home and the base classes, the order
in the common.loader string will decide which gets loaded (first comes
first).
By the way: all class loaders used in former Tomcat releases are still
present in TC 6 and there functionality is the same. Because this class
loader hierarchy confused a lot of users, we decided to switch to a
simple default distribution layout by moving everything into the common
classloader. In catalina.properties you can see, that all loaders
(common, server, shared) are still there and configurable, but only
common has classes in its search path.
Regards,
Rainer
Brian Millett wrote:
Filip Hanik - Dev Lists escribĂo:
$CATALINA_HOME/lib
Doesn't that defeat the CATALINA_BASE setup for multiple instances of tomcat?
Brian Millett wrote:
Hello, I've setup my tomcat 6.0.13 with the CATALINA_HOME=/opt/tomcat and
CATALINA_BASE=/opt/webBaseDir on a FC6 system.
I read in http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
"Common - This class loader contains additional classes that are made
visible to
both Tomcat internal classes and to all web applications. Normally,
application
classes should NOT be placed here. All unpacked classes and resources in
$CATALINA_HOME/lib, as well as classes and resources in JAR files are
made
visible through this class loader."
and in http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html
"The description below uses the variable name $CATALINA_HOME to refer
to the
directory into which you have installed Tomcat 6, and is the base
directory
against which most relative paths are resolved. However, if you have
configured
Tomcat 6 for multiple instances by setting a CATALINA_BASE directory,
you should
use $CATALINA_BASE instead of $CATALINA_HOME for each of these
references."
and in conf/catalina.properties
"# List of comma-separated paths defining the contents of the "common"
# classloader. Prefixes should be used to define what is the
repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or
absolute.
# If left as blank,the JVM system loader will be used as Catalina's
"common"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar"
and also in org/apache/catalina/startup/Bootstrap.java
" while ((i=repository.indexOf(CATALINA_HOME_TOKEN))>=0) {
replace=true;
if (i>0) {
repository = repository.substring(0,i) +
getCatalinaHome()
+
repository.substring(i+CATALINA_HOME_TOKEN.length());
} else {
repository = getCatalinaHome()
+
repository.substring(CATALINA_HOME_TOKEN.length());
}
}
while ((i=repository.indexOf(CATALINA_BASE_TOKEN))>=0) {
replace=true;
if (i>0) {
repository = repository.substring(0,i) +
getCatalinaBase()
+
repository.substring(i+CATALINA_BASE_TOKEN.length());
} else {
repository = getCatalinaBase()
+
repository.substring(CATALINA_BASE_TOKEN.length());
}
}"
And finally in the RUNNING.txt file
"In many circumstances, it is desirable to have a single copy of a Tomcat
binary distribution shared among multiple users on the same server.
To make
this possible, you can pass a "-Dcatalina.base=$CATALINA_BASE"
argument when
executing the startup command (see (2)). In this
"-Dcatalina.base=$CATALINA_BASE" argument, replace $CATALINA_BASE with
the
directory that contains the files for your 'personal' Tomcat instance."
The behavior I've seen is that on startup, the jar files in
CATALINA_HOME/lib
are loaded before CATALINA_BASE/lib. Is that correct?
I've seen that I must have the distributed jar files in
CATALINA_HOME/lib, but
for my "personal" tomcat, I have to put the jar files in
CATALINA_BASE/lib.
Are the documentation pages for all of the class loading inconsistant?
Do I need to add to the catalina.properties file
"common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.base}/lib,${catalina.base}/lib/*.jar"
?
What is the correct place for the "Common" jars to get loaded with a
multiple
tomcat instances?
I'm a little confused.
Thanks.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]