You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Anne, Radhakrishna (NSN - IN/Bangalore)" <ra...@nsn.com> on 2011/07/26 10:38:39 UTC

RE: Class loading order

Hello,

I would like to changes the default order look up for class loading, as
I understood from the doc, the order of look up is 
1)	WEB-INF/classes
2)	WEB_INF/lib.

Now I wanted to change this order and have my own order look up as shown
below i.e.
1)	/opt/shared/classes
2)	WEB-INF/classes
3)	WEB_INF/lib.

Can someone help me out..? I am using tomcat 6 version.


Regards,Mailcode: tL3PbjBL 
Krishna



Re: Class loading order

Posted by Pid <pi...@pidster.com>.
On 27/07/2011 08:55, Joseph wrote:
> I think that what Anne want is the hot swap of classes ,replace loaded
> classes with new version in hotfix jars.That might break the security of
> java,I reckon. am I right ?

If the requirement is 'live' replacement of classes already loaded by
the JVM then the OP will definitely need to build a custom classloader.

It won't break Java security per se, but it is likely to be error prone.
 OSGI has some answers for this kind of thing AFAIK, but unaugmented
Java + Tomcat won't like it at all.


p



> 2011/7/27 Pid <pi...@pidster.com>
> 
>> On 27/07/2011 06:19, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
>>> Hello,
>>>
>>> Can I use virtualWebAppLoader class to meet my requirements..?
>>
>> You might be able to, but please note: 'hot fixes' and 'patches' are not
>> concepts that work well with compiled webapps.
>>
>> If you need to update a webapp, you should release a new version.
>> Distributing instructions for applying updates to individual class files
>> is going to cause you all sorts of support problems.
>>
>> Likewise, applying 'hot fixes' to plugin JARs isn't a good idea.
>>
>> E.g.  If there are sequential modifications to a class, each will have
>> to carry all the previous changes.  Why not just update the JAR instead?
>>
>> You can also enable the shared classloader in
>> tomcat/conf/catalina.properties.
>>
>>
>> p
>>
>>> Regards
>>> Krishna
>>>
>>>
>>> -----Original Message-----
>>> From: Anne, Radhakrishna (NSN - IN/Bangalore)
>>> Sent: Tuesday, July 26, 2011 2:24 PM
>>> To: Tomcat Users List
>>> Subject: RE: Class loading order
>>>
>>> Hello,
>>>
>>> My web applications is designed to plug-in 3 rd party modules. 3rd party
>>> jars and my jars would placed under WEB-INF/libs.
>>> In case of bugs, the third party developer may provide hot fixes , which
>>> would be placed under WEB-INF/classes usually.
>>> I do not want to place their hot fixes under WEB-INF/classes, as they
>>> may conflict with my hot fixes and this would create some problems
>>> during maintenance.
>>>
>>> So I was checking the possibility of defining a new location for 3rd
>>> party hot fixes. Is there any way to do this..?
>>>
>>> Regards,
>>> Krishna
>>>
>>>
>>> -----Original Message-----
>>> From: ext Pid [mailto:pid@pidster.com]
>>> Sent: Tuesday, July 26, 2011 2:15 PM
>>> To: Tomcat Users List
>>> Subject: Re: Class loading order
>>>
>>> On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
>>>>
>>>> Hello,
>>>>
>>>> I would like to changes the default order look up for class loading,
>>> as
>>>> I understood from the doc, the order of look up is
>>>> 1)   WEB-INF/classes
>>>> 2)   WEB_INF/lib.
>>>>
>>>> Now I wanted to change this order and have my own order look up as
>>> shown
>>>> below i.e.
>>>> 1)   /opt/shared/classes
>>>> 2)   WEB-INF/classes
>>>> 3)   WEB_INF/lib.
>>>>
>>>> Can someone help me out..? I am using tomcat 6 version.
>>>
>>> No, the only way to do this is via a custom classloader of your own
>>> design.  It is probably a bad idea to do this - a webapp's classloader
>>> is supposed to load its own classes first.
>>>
>>> Why can't you include the classes in the webapp?
>>>
>>>
>>> p
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 


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


Re: Class loading order

Posted by Joseph <wu...@gmail.com>.
I think that what Anne want is the hot swap of classes ,replace loaded
classes with new version in hotfix jars.That might break the security of
java,I reckon. am I right ?

2011/7/27 Pid <pi...@pidster.com>

> On 27/07/2011 06:19, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> > Hello,
> >
> > Can I use virtualWebAppLoader class to meet my requirements..?
>
> You might be able to, but please note: 'hot fixes' and 'patches' are not
> concepts that work well with compiled webapps.
>
> If you need to update a webapp, you should release a new version.
> Distributing instructions for applying updates to individual class files
> is going to cause you all sorts of support problems.
>
> Likewise, applying 'hot fixes' to plugin JARs isn't a good idea.
>
> E.g.  If there are sequential modifications to a class, each will have
> to carry all the previous changes.  Why not just update the JAR instead?
>
> You can also enable the shared classloader in
> tomcat/conf/catalina.properties.
>
>
> p
>
> > Regards
> > Krishna
> >
> >
> > -----Original Message-----
> > From: Anne, Radhakrishna (NSN - IN/Bangalore)
> > Sent: Tuesday, July 26, 2011 2:24 PM
> > To: Tomcat Users List
> > Subject: RE: Class loading order
> >
> > Hello,
> >
> > My web applications is designed to plug-in 3 rd party modules. 3rd party
> > jars and my jars would placed under WEB-INF/libs.
> > In case of bugs, the third party developer may provide hot fixes , which
> > would be placed under WEB-INF/classes usually.
> > I do not want to place their hot fixes under WEB-INF/classes, as they
> > may conflict with my hot fixes and this would create some problems
> > during maintenance.
> >
> > So I was checking the possibility of defining a new location for 3rd
> > party hot fixes. Is there any way to do this..?
> >
> > Regards,
> > Krishna
> >
> >
> > -----Original Message-----
> > From: ext Pid [mailto:pid@pidster.com]
> > Sent: Tuesday, July 26, 2011 2:15 PM
> > To: Tomcat Users List
> > Subject: Re: Class loading order
> >
> > On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> >>
> >> Hello,
> >>
> >> I would like to changes the default order look up for class loading,
> > as
> >> I understood from the doc, the order of look up is
> >> 1)   WEB-INF/classes
> >> 2)   WEB_INF/lib.
> >>
> >> Now I wanted to change this order and have my own order look up as
> > shown
> >> below i.e.
> >> 1)   /opt/shared/classes
> >> 2)   WEB-INF/classes
> >> 3)   WEB_INF/lib.
> >>
> >> Can someone help me out..? I am using tomcat 6 version.
> >
> > No, the only way to do this is via a custom classloader of your own
> > design.  It is probably a bad idea to do this - a webapp's classloader
> > is supposed to load its own classes first.
> >
> > Why can't you include the classes in the webapp?
> >
> >
> > p
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Never trust your computer.

RE: Class loading order

Posted by "Anne, Radhakrishna (NSN - IN/Bangalore)" <ra...@nsn.com>.
Hello,

Yes, we will take care of sequential modifications of class during
updates, and that is not a problem for us.
I have tried changing tomcat/conf/catalina.properties, but that did not
work for me..

Regards,
Krishna


-----Original Message-----
From: ext Pid [mailto:pid@pidster.com] 
Sent: Wednesday, July 27, 2011 1:12 PM
To: Tomcat Users List
Subject: Re: Class loading order

On 27/07/2011 06:19, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> Hello,
> 
> Can I use virtualWebAppLoader class to meet my requirements..?

You might be able to, but please note: 'hot fixes' and 'patches' are not
concepts that work well with compiled webapps.

If you need to update a webapp, you should release a new version.
Distributing instructions for applying updates to individual class files
is going to cause you all sorts of support problems.

Likewise, applying 'hot fixes' to plugin JARs isn't a good idea.

E.g.  If there are sequential modifications to a class, each will have
to carry all the previous changes.  Why not just update the JAR instead?

You can also enable the shared classloader in
tomcat/conf/catalina.properties.


p

> Regards 
> Krishna
> 
> 
> -----Original Message-----
> From: Anne, Radhakrishna (NSN - IN/Bangalore) 
> Sent: Tuesday, July 26, 2011 2:24 PM
> To: Tomcat Users List
> Subject: RE: Class loading order
> 
> Hello,
> 
> My web applications is designed to plug-in 3 rd party modules. 3rd
party
> jars and my jars would placed under WEB-INF/libs.
> In case of bugs, the third party developer may provide hot fixes ,
which
> would be placed under WEB-INF/classes usually.
> I do not want to place their hot fixes under WEB-INF/classes, as they
> may conflict with my hot fixes and this would create some problems
> during maintenance.
> 
> So I was checking the possibility of defining a new location for 3rd
> party hot fixes. Is there any way to do this..?
> 
> Regards, 
> Krishna
> 
> 
> -----Original Message-----
> From: ext Pid [mailto:pid@pidster.com] 
> Sent: Tuesday, July 26, 2011 2:15 PM
> To: Tomcat Users List
> Subject: Re: Class loading order
> 
> On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
>>
>> Hello,
>>
>> I would like to changes the default order look up for class loading,
> as
>> I understood from the doc, the order of look up is 
>> 1)	WEB-INF/classes
>> 2)	WEB_INF/lib.
>>
>> Now I wanted to change this order and have my own order look up as
> shown
>> below i.e.
>> 1)	/opt/shared/classes
>> 2)	WEB-INF/classes
>> 3)	WEB_INF/lib.
>>
>> Can someone help me out..? I am using tomcat 6 version.
> 
> No, the only way to do this is via a custom classloader of your own
> design.  It is probably a bad idea to do this - a webapp's classloader
> is supposed to load its own classes first.
> 
> Why can't you include the classes in the webapp?
> 
> 
> p
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


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


Re: Class loading order

Posted by Pid <pi...@pidster.com>.
On 27/07/2011 06:19, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> Hello,
> 
> Can I use virtualWebAppLoader class to meet my requirements..?

You might be able to, but please note: 'hot fixes' and 'patches' are not
concepts that work well with compiled webapps.

If you need to update a webapp, you should release a new version.
Distributing instructions for applying updates to individual class files
is going to cause you all sorts of support problems.

Likewise, applying 'hot fixes' to plugin JARs isn't a good idea.

E.g.  If there are sequential modifications to a class, each will have
to carry all the previous changes.  Why not just update the JAR instead?

You can also enable the shared classloader in
tomcat/conf/catalina.properties.


p

> Regards 
> Krishna
> 
> 
> -----Original Message-----
> From: Anne, Radhakrishna (NSN - IN/Bangalore) 
> Sent: Tuesday, July 26, 2011 2:24 PM
> To: Tomcat Users List
> Subject: RE: Class loading order
> 
> Hello,
> 
> My web applications is designed to plug-in 3 rd party modules. 3rd party
> jars and my jars would placed under WEB-INF/libs.
> In case of bugs, the third party developer may provide hot fixes , which
> would be placed under WEB-INF/classes usually.
> I do not want to place their hot fixes under WEB-INF/classes, as they
> may conflict with my hot fixes and this would create some problems
> during maintenance.
> 
> So I was checking the possibility of defining a new location for 3rd
> party hot fixes. Is there any way to do this..?
> 
> Regards, 
> Krishna
> 
> 
> -----Original Message-----
> From: ext Pid [mailto:pid@pidster.com] 
> Sent: Tuesday, July 26, 2011 2:15 PM
> To: Tomcat Users List
> Subject: Re: Class loading order
> 
> On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
>>
>> Hello,
>>
>> I would like to changes the default order look up for class loading,
> as
>> I understood from the doc, the order of look up is 
>> 1)	WEB-INF/classes
>> 2)	WEB_INF/lib.
>>
>> Now I wanted to change this order and have my own order look up as
> shown
>> below i.e.
>> 1)	/opt/shared/classes
>> 2)	WEB-INF/classes
>> 3)	WEB_INF/lib.
>>
>> Can someone help me out..? I am using tomcat 6 version.
> 
> No, the only way to do this is via a custom classloader of your own
> design.  It is probably a bad idea to do this - a webapp's classloader
> is supposed to load its own classes first.
> 
> Why can't you include the classes in the webapp?
> 
> 
> p
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


RE: Class loading order

Posted by "Anne, Radhakrishna (NSN - IN/Bangalore)" <ra...@nsn.com>.
Hello,

Can I use virtualWebAppLoader class to meet my requirements..?

Regards 
Krishna


-----Original Message-----
From: Anne, Radhakrishna (NSN - IN/Bangalore) 
Sent: Tuesday, July 26, 2011 2:24 PM
To: Tomcat Users List
Subject: RE: Class loading order

Hello,

My web applications is designed to plug-in 3 rd party modules. 3rd party
jars and my jars would placed under WEB-INF/libs.
In case of bugs, the third party developer may provide hot fixes , which
would be placed under WEB-INF/classes usually.
I do not want to place their hot fixes under WEB-INF/classes, as they
may conflict with my hot fixes and this would create some problems
during maintenance.

So I was checking the possibility of defining a new location for 3rd
party hot fixes. Is there any way to do this..?

Regards, 
Krishna


-----Original Message-----
From: ext Pid [mailto:pid@pidster.com] 
Sent: Tuesday, July 26, 2011 2:15 PM
To: Tomcat Users List
Subject: Re: Class loading order

On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> 
> Hello,
> 
> I would like to changes the default order look up for class loading,
as
> I understood from the doc, the order of look up is 
> 1)	WEB-INF/classes
> 2)	WEB_INF/lib.
> 
> Now I wanted to change this order and have my own order look up as
shown
> below i.e.
> 1)	/opt/shared/classes
> 2)	WEB-INF/classes
> 3)	WEB_INF/lib.
> 
> Can someone help me out..? I am using tomcat 6 version.

No, the only way to do this is via a custom classloader of your own
design.  It is probably a bad idea to do this - a webapp's classloader
is supposed to load its own classes first.

Why can't you include the classes in the webapp?


p



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


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


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


RE: Class loading order

Posted by "Anne, Radhakrishna (NSN - IN/Bangalore)" <ra...@nsn.com>.
Hello,

My web applications is designed to plug-in 3 rd party modules. 3rd party
jars and my jars would placed under WEB-INF/libs.
In case of bugs, the third party developer may provide hot fixes , which
would be placed under WEB-INF/classes usually.
I do not want to place their hot fixes under WEB-INF/classes, as they
may conflict with my hot fixes and this would create some problems
during maintenance.

So I was checking the possibility of defining a new location for 3rd
party hot fixes. Is there any way to do this..?

Regards, 
Krishna


-----Original Message-----
From: ext Pid [mailto:pid@pidster.com] 
Sent: Tuesday, July 26, 2011 2:15 PM
To: Tomcat Users List
Subject: Re: Class loading order

On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> 
> Hello,
> 
> I would like to changes the default order look up for class loading,
as
> I understood from the doc, the order of look up is 
> 1)	WEB-INF/classes
> 2)	WEB_INF/lib.
> 
> Now I wanted to change this order and have my own order look up as
shown
> below i.e.
> 1)	/opt/shared/classes
> 2)	WEB-INF/classes
> 3)	WEB_INF/lib.
> 
> Can someone help me out..? I am using tomcat 6 version.

No, the only way to do this is via a custom classloader of your own
design.  It is probably a bad idea to do this - a webapp's classloader
is supposed to load its own classes first.

Why can't you include the classes in the webapp?


p



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


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


Re: Class loading order

Posted by Pid <pi...@pidster.com>.
On 26/07/2011 09:38, Anne, Radhakrishna (NSN - IN/Bangalore) wrote:
> 
> Hello,
> 
> I would like to changes the default order look up for class loading, as
> I understood from the doc, the order of look up is 
> 1)	WEB-INF/classes
> 2)	WEB_INF/lib.
> 
> Now I wanted to change this order and have my own order look up as shown
> below i.e.
> 1)	/opt/shared/classes
> 2)	WEB-INF/classes
> 3)	WEB_INF/lib.
> 
> Can someone help me out..? I am using tomcat 6 version.

No, the only way to do this is via a custom classloader of your own
design.  It is probably a bad idea to do this - a webapp's classloader
is supposed to load its own classes first.

Why can't you include the classes in the webapp?


p



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