You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thomas Papke <tp...@thopap.de> on 2007/04/24 09:09:02 UTC

Classloader Concept

I need some help to the classloader concept of tomcat... (version 5.5.)

Our Tomcat has about 60 webapps running - right now every webapps have 
in their Web/lib directory the libs for activation and java mail (among 
other libs). As I understand, right now this libs are 60times loaded 
into Permgen - if i will but them into the common/lib of tomcat - they 
are loaded only once info permgen? Any problem to share activation.jar 
and mail.jar inside common/lib for all webapps?

Thanks a lot,

Thomas

---------------------------------------------------------------------
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: Classloader Concept

Posted by Rainer Jung <ra...@kippdata.de>.
common: shared between all webapps and tomcat itself
shared: only shared between all webapps

Luis Rivera schrieb:
>   Hi,
> 
> Just as a comment. I use the shared classloader by using the shared folder
> to avoid loading multiple times my shared libraries (for jni use). I am not
> sure what is the difference with the common/lib classloader, but it did not
> work when I used that one.
> 
> --Luis R.

---------------------------------------------------------------------
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: Classloader Concept

Posted by Rainer Jung <ra...@kippdata.de>.
... and finally don't forget, that the pathes used by these class
loaders are configured in conf/catalina.properties.

Luis Rivera schrieb:
> Well, that makes sense and I have had no problems using the shared class
> loader. I guess I did something wrong when I tried to use the common class
> loader for my jni classes. I guess I am light years away from really
> knowing
> tomcat :)
> 
> --Luis R.
> 
> On 4/24/07, David Smith <dn...@cornell.edu> wrote:
>>
>> My experience has been the reverse -- shared/lib is usually disabled and
>> not working, common/lib is used most of the time.
>>
>> The difference between the two is common/lib is visible to both tomcat
>> internals and the webapps.  That's why we put the db drivers in there
>> for container managed connection pooling.   Shared/lib is only visible
>> to the webapps -- tomcat internals can't see or access it.
>>
>> --David

---------------------------------------------------------------------
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: Classloader Concept

Posted by Luis Rivera <lu...@gmail.com>.
Well, that makes sense and I have had no problems using the shared class
loader. I guess I did something wrong when I tried to use the common class
loader for my jni classes. I guess I am light years away from really knowing
tomcat :)

--Luis R.

On 4/24/07, David Smith <dn...@cornell.edu> wrote:
>
> My experience has been the reverse -- shared/lib is usually disabled and
> not working, common/lib is used most of the time.
>
> The difference between the two is common/lib is visible to both tomcat
> internals and the webapps.  That's why we put the db drivers in there
> for container managed connection pooling.   Shared/lib is only visible
> to the webapps -- tomcat internals can't see or access it.
>
> --David
>
> Luis Rivera wrote:
>
> >   Hi,
> >
> > Just as a comment. I use the shared classloader by using the shared
> > folder
> > to avoid loading multiple times my shared libraries (for jni use). I
> > am not
> > sure what is the difference with the common/lib classloader, but it
> > did not
> > work when I used that one.
> >
> > --Luis R.
> >
> > On 4/24/07, David Delbecq <de...@oma.be> wrote:
> >
> >>
> >> Sorry Leon but you are wrong.
> >> What Thomas looks for is common/lib, not server/lib
> >> according to
> >> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html it's
> >> common/lib that is loaded in common classloader. server/lib is loaded
> in
> >> catalina classloader which is not visible for webapps.
> >>
> >>
> >> To answer Thomas, yes, classes in common/lib get loaded only once in
> >> permgen. The problem of loading classes in common/lib is that they get
> >> shared. If some webapp call some static setter in JAF or JavaMail (to
> >> set a resolver of any kind) this one will be used by all running
> >> webapps. This can lead to curious bugs you might take a lot of time to
> >> solve.
> >>
> >>
> >> En l'instant précis du 24/04/07 10:42, Leon Rosenberg s'exprimait en
> ces
> >> termes:
> >> > i thinks its server/lib you are looking for (or common/endorsed) but
> >> > i'm not sure whether java mail has some static fields which will be
> >> > screwed by sharing them among all apps.
> >> >
> >> > leon
> >> >
> >> >
> >> > On 4/24/07, Thomas Papke <tp...@thopap.de> wrote:
> >> >> I need some help to the classloader concept of tomcat... (version
> >> 5.5.)
> >> >>
> >> >> Our Tomcat has about 60 webapps running - right now every webapps
> >> have
> >> >> in their Web/lib directory the libs for activation and java mail
> >> (among
> >> >> other libs). As I understand, right now this libs are 60times loaded
> >> >> into Permgen - if i will but them into the common/lib of tomcat -
> >> they
> >> >> are loaded only once info permgen? Any problem to share
> >> activation.jar
> >> >> and mail.jar inside common/lib for all webapps?
> >> >>
> >> >> Thanks a lot,
> >> >>
> >> >> Thomas
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> 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
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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: Classloader Concept

Posted by David Smith <dn...@cornell.edu>.
My experience has been the reverse -- shared/lib is usually disabled and 
not working, common/lib is used most of the time.

The difference between the two is common/lib is visible to both tomcat 
internals and the webapps.  That's why we put the db drivers in there 
for container managed connection pooling.   Shared/lib is only visible 
to the webapps -- tomcat internals can't see or access it.

--David

Luis Rivera wrote:

>   Hi,
>
> Just as a comment. I use the shared classloader by using the shared 
> folder
> to avoid loading multiple times my shared libraries (for jni use). I 
> am not
> sure what is the difference with the common/lib classloader, but it 
> did not
> work when I used that one.
>
> --Luis R.
>
> On 4/24/07, David Delbecq <de...@oma.be> wrote:
>
>>
>> Sorry Leon but you are wrong.
>> What Thomas looks for is common/lib, not server/lib
>> according to
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html it's
>> common/lib that is loaded in common classloader. server/lib is loaded in
>> catalina classloader which is not visible for webapps.
>>
>>
>> To answer Thomas, yes, classes in common/lib get loaded only once in
>> permgen. The problem of loading classes in common/lib is that they get
>> shared. If some webapp call some static setter in JAF or JavaMail (to
>> set a resolver of any kind) this one will be used by all running
>> webapps. This can lead to curious bugs you might take a lot of time to
>> solve.
>>
>>
>> En l'instant précis du 24/04/07 10:42, Leon Rosenberg s'exprimait en ces
>> termes:
>> > i thinks its server/lib you are looking for (or common/endorsed) but
>> > i'm not sure whether java mail has some static fields which will be
>> > screwed by sharing them among all apps.
>> >
>> > leon
>> >
>> >
>> > On 4/24/07, Thomas Papke <tp...@thopap.de> wrote:
>> >> I need some help to the classloader concept of tomcat... (version 
>> 5.5.)
>> >>
>> >> Our Tomcat has about 60 webapps running - right now every webapps 
>> have
>> >> in their Web/lib directory the libs for activation and java mail 
>> (among
>> >> other libs). As I understand, right now this libs are 60times loaded
>> >> into Permgen - if i will but them into the common/lib of tomcat - 
>> they
>> >> are loaded only once info permgen? Any problem to share 
>> activation.jar
>> >> and mail.jar inside common/lib for all webapps?
>> >>
>> >> Thanks a lot,
>> >>
>> >> Thomas
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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: Classloader Concept

Posted by Luis Rivera <lu...@gmail.com>.
   Hi,

Just as a comment. I use the shared classloader by using the shared folder
to avoid loading multiple times my shared libraries (for jni use). I am not
sure what is the difference with the common/lib classloader, but it did not
work when I used that one.

--Luis R.

On 4/24/07, David Delbecq <de...@oma.be> wrote:
>
> Sorry Leon but you are wrong.
> What Thomas looks for is common/lib, not server/lib
> according to
> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html it's
> common/lib that is loaded in common classloader. server/lib is loaded in
> catalina classloader which is not visible for webapps.
>
>
> To answer Thomas, yes, classes in common/lib get loaded only once in
> permgen. The problem of loading classes in common/lib is that they get
> shared. If some webapp call some static setter in JAF or JavaMail (to
> set a resolver of any kind) this one will be used by all running
> webapps. This can lead to curious bugs you might take a lot of time to
> solve.
>
>
> En l'instant précis du 24/04/07 10:42, Leon Rosenberg s'exprimait en ces
> termes:
> > i thinks its server/lib you are looking for (or common/endorsed) but
> > i'm not sure whether java mail has some static fields which will be
> > screwed by sharing them among all apps.
> >
> > leon
> >
> >
> > On 4/24/07, Thomas Papke <tp...@thopap.de> wrote:
> >> I need some help to the classloader concept of tomcat... (version 5.5.)
> >>
> >> Our Tomcat has about 60 webapps running - right now every webapps have
> >> in their Web/lib directory the libs for activation and java mail (among
> >> other libs). As I understand, right now this libs are 60times loaded
> >> into Permgen - if i will but them into the common/lib of tomcat - they
> >> are loaded only once info permgen? Any problem to share activation.jar
> >> and mail.jar inside common/lib for all webapps?
> >>
> >> Thanks a lot,
> >>
> >> Thomas
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
>
>
> ---------------------------------------------------------------------
> 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: Classloader Concept

Posted by David Delbecq <de...@oma.be>.
Sorry Leon but you are wrong.
What Thomas looks for is common/lib, not server/lib
according to
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html it's
common/lib that is loaded in common classloader. server/lib is loaded in
catalina classloader which is not visible for webapps.


To answer Thomas, yes, classes in common/lib get loaded only once in
permgen. The problem of loading classes in common/lib is that they get
shared. If some webapp call some static setter in JAF or JavaMail (to
set a resolver of any kind) this one will be used by all running
webapps. This can lead to curious bugs you might take a lot of time to
solve.


En l'instant précis du 24/04/07 10:42, Leon Rosenberg s'exprimait en ces
termes:
> i thinks its server/lib you are looking for (or common/endorsed) but
> i'm not sure whether java mail has some static fields which will be
> screwed by sharing them among all apps.
>
> leon
>
>
> On 4/24/07, Thomas Papke <tp...@thopap.de> wrote:
>> I need some help to the classloader concept of tomcat... (version 5.5.)
>>
>> Our Tomcat has about 60 webapps running - right now every webapps have
>> in their Web/lib directory the libs for activation and java mail (among
>> other libs). As I understand, right now this libs are 60times loaded
>> into Permgen - if i will but them into the common/lib of tomcat - they
>> are loaded only once info permgen? Any problem to share activation.jar
>> and mail.jar inside common/lib for all webapps?
>>
>> Thanks a lot,
>>
>> Thomas
>>
>> ---------------------------------------------------------------------
>> 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
>


---------------------------------------------------------------------
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: Classloader Concept

Posted by Leon Rosenberg <ro...@googlemail.com>.
i thinks its server/lib you are looking for (or common/endorsed) but
i'm not sure whether java mail has some static fields which will be
screwed by sharing them among all apps.

leon


On 4/24/07, Thomas Papke <tp...@thopap.de> wrote:
> I need some help to the classloader concept of tomcat... (version 5.5.)
>
> Our Tomcat has about 60 webapps running - right now every webapps have
> in their Web/lib directory the libs for activation and java mail (among
> other libs). As I understand, right now this libs are 60times loaded
> into Permgen - if i will but them into the common/lib of tomcat - they
> are loaded only once info permgen? Any problem to share activation.jar
> and mail.jar inside common/lib for all webapps?
>
> Thanks a lot,
>
> Thomas
>
> ---------------------------------------------------------------------
> 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