You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Ilya Platonov <re...@gmail.com> on 2006/03/22 07:36:17 UTC

One classloader for different WAR-files

I have some WAR-files that use common libraries. Is there any way to force
them to use same Classloader for this libraries?

Right now I see two variants to do it

1) To put wars in one ear file.
2) Put common libraries into geronimo libraries repository.

But I'm not sure this is going to work. Is there any special configuration I
should use for this variants? Is there any other variant to do this?

Thanks

Re: One classloader for different WAR-files

Posted by Ilya Platonov <re...@gmail.com>.
I tried variant with ear and it works.

Are you sure that variant 3 will work? I tried to play with parent
deployment plans  and didn't succeed.

On 3/22/06, David Jencks <da...@yahoo.com> wrote:
>
>
> On Mar 21, 2006, at 10:36 PM, Ilya Platonov wrote:
>
> > I have some WAR-files that use common libraries. Is there any way
> > to force them to use same Classloader for this libraries?
> >
> > Right now I see two variants to do it
> >
> > 1) To put wars in one ear file.
>
> If you put the libraries in the *.war/WEB-INF/lib, this will not get
> the libraries in the same classloader.  If you put them in the ear
> somewhere and use manifest classpaths in the wars to pick them up,
> they still won't be in the same classloader: each will get into the
> appropriate web app classloader.
> > 2) Put common libraries into geronimo libraries repository.
> >
> I think that's a good idea because it makes your web apps smaller,
> but it wont get the jars into the same classloader: each web app will
> load the jar in its own classloader.  I would do this anyway, in
> combination with:
>
> 3) You could make one web app the parent of the other and use
> contextPriorityClassloading=false.
>
> For (2) or (3) you will need geronimo plans: for (2), to add the
> dependencies to the web app, for (3) to specify the "other" web app
> as a parent/import.
>
> Hope this helps
> david jencks
>
>
> > But I'm not sure this is going to work. Is there any special
> > configuration I should use for this variants? Is there any other
> > variant to do this?
> >
> > Thanks
>
>

Re: One classloader for different WAR-files

Posted by David Jencks <da...@yahoo.com>.
On Mar 21, 2006, at 10:36 PM, Ilya Platonov wrote:

> I have some WAR-files that use common libraries. Is there any way  
> to force them to use same Classloader for this libraries?
>
> Right now I see two variants to do it
>
> 1) To put wars in one ear file.

If you put the libraries in the *.war/WEB-INF/lib, this will not get  
the libraries in the same classloader.  If you put them in the ear  
somewhere and use manifest classpaths in the wars to pick them up,  
they still won't be in the same classloader: each will get into the  
appropriate web app classloader.
> 2) Put common libraries into geronimo libraries repository.
>
I think that's a good idea because it makes your web apps smaller,  
but it wont get the jars into the same classloader: each web app will  
load the jar in its own classloader.  I would do this anyway, in  
combination with:

3) You could make one web app the parent of the other and use  
contextPriorityClassloading=false.

For (2) or (3) you will need geronimo plans: for (2), to add the  
dependencies to the web app, for (3) to specify the "other" web app  
as a parent/import.

Hope this helps
david jencks


> But I'm not sure this is going to work. Is there any special  
> configuration I should use for this variants? Is there any other  
> variant to do this?
>
> Thanks