You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian Millett <bm...@gmail.com> on 2007/05/21 16:24:03 UTC

questions about the classloader in tomcat 6

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.
-- 
Brian Millett - [ Sinclair and Garibaldi, "Deathwalker"]
"You think it'll always be like this, Michael? Little powers at the mercy
    of bigger powers, politics before morality, expediency before justice?"
'Seems to work for everybody...except you. Maybe that's why I like you.'

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: questions about the classloader in tomcat 6

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Brian Millett [mailto:bmillett@gmail.com] 
> Subject: Re: questions about the classloader in tomcat 6
> 
> Is there a need to move to the "newer" common classloader?

There may not be a need, but performance is certainly improved with
fewer class loaders and shorter classpaths for each loader.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Rainer Jung <ra...@kippdata.de>.
> Thanks.  I saw that in catalina.properties.  If I fill those values in (for the
> appropriate classloader) I can duplicate the behavior of the older systems.
> That will help in migrating large installations that are running tomcat 5 to
> tomcat 6.
> 
> Is there a need to move to the "newer" common classloader?  I guess my question
> is if the older ways will be deprecated in the future?

I think there was no official agreement on that, but the fact that the 
TC 6 classloader docs do not mention the server and the shared class 
loader any longer indicate that this is not totally unlikely. But it 
might depend on user feedback oncerning the new "easier" default layout.

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Brian Millett <bm...@gmail.com>.
Rainer Jung escribío:
> 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.


Thanks.  I saw that in catalina.properties.  If I fill those values in (for the
appropriate classloader) I can duplicate the behavior of the older systems.
That will help in migrating large installations that are running tomcat 5 to
tomcat 6.

Is there a need to move to the "newer" common classloader?  I guess my question
is if the older ways will be deprecated in the future?

Thanks.
-- 
Brian Millett - [ N'Grath and Garibaldi, "Survivors"]
"You are police."
'Not any more. I'm a fugitive. Don't tell me you haven't heard?'
"Have heard. You are *still* police."

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Rainer Jung <ra...@kippdata.de>.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Brian Millett <bm...@gmail.com>.
Filip Hanik - Dev Lists escribío:
> 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?
>>   
> I always get the BASE and HOME mixed up. but I believe HOME is the
> installation of all the shared binaries,
> hence all common libraries would be placed there
> CATALINA_BASE is used for all runtime directories, such as webapps,
> work, conf etc
> 

Thanks
-- 
Brian Millett - [ Londo and Timov, "Soul Mates"]
"They're merely expressing their feelings for me."
'I can do that." [Timov slaps Londo]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
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?
>   
I always get the BASE and HOME mixed up. but I believe HOME is the 
installation of all the shared binaries,
hence all common libraries would be placed there
CATALINA_BASE is used for all runtime directories, such as webapps, 
work, conf etc

Filip
>   
>> 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: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>     
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Brian Millett <bm...@gmail.com>.
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


-- 
Brian Millett - [ Ivanova and Garibaldi, "Survivors"]
"What, does something about this surprise you, Mr. Garibaldi?"
'*Nothing* the government does surprises me.'
"That's a very Russian attitude. I commend you."

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions about the classloader in tomcat 6

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
$CATALINA_HOME/lib

Filip

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org