You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by saurabh tiwari <sa...@gmail.com> on 2016/07/13 10:19:26 UTC
Tomcat 8 classloading
Hi There,
We are about to upgrade from tomcat-7.0.65 to tomcat-8.0.XX. and this is
regarding the loading of same JARs within the different application. to
understand the scenario, consider below case
Tomcat 8 ---
webapps
a.war--> lib--> spring.jar
b.war--> lib--> spring.jar
here b.war is just a copy of a.war and renamed just to differentiate hence
spring.jar is same for both the applications.
My question is
1) will spring.jar loaded twice
2) how to i make sure to load it only once ( if loaded twice)
Thanks,
Saurabh Tiwari
9158483338
Re: Tomcat 8 classloading
Posted by saurabh tiwari <sa...@gmail.com>.
Thanks a lot Chris.
Thanks,
Saurabh Tiwari
9158483338
On Wed, Jul 13, 2016 at 1:49 PM, chris derham <ch...@derham.me.uk> wrote:
> > Hi There,
> >
> > We are about to upgrade from tomcat-7.0.65 to tomcat-8.0.XX. and this is
> > regarding the loading of same JARs within the different application. to
> > understand the scenario, consider below case
> >
> > Tomcat 8 ---
> > webapps
> > a.war--> lib--> spring.jar
> > b.war--> lib--> spring.jar
> >
> > here b.war is just a copy of a.war and renamed just to differentiate
> hence
> > spring.jar is same for both the applications.
> >
> > My question is
> >
> > 1) will spring.jar loaded twice
>
> yes it will be loaded twice
>
> > 2) how to i make sure to load it only once ( if loaded twice)
>
> This question comes up frequently. Search the mailing list for shared
> class loader to see the details. The upshot is that this can be done
> using shared class loader, however there are real technical issues if
> you do this - class cast exceptions, difficulty performing upgrades to
> individual wars without taking down all of tomcat. The only positive
> is that you might save a few MB of memory cost by having the same jar
> loaded twice in memory.
>
> I've been on this mailing list for ~8 years, and every time this
> issues comes up (about 5 times a year?), the tomcat developers suggest
> that the proposed memory saving isn't not worth the problems that it
> causes..
>
> HTH
>
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat 8 classloading
Posted by chris derham <ch...@derham.me.uk>.
> Hi There,
>
> We are about to upgrade from tomcat-7.0.65 to tomcat-8.0.XX. and this is
> regarding the loading of same JARs within the different application. to
> understand the scenario, consider below case
>
> Tomcat 8 ---
> webapps
> a.war--> lib--> spring.jar
> b.war--> lib--> spring.jar
>
> here b.war is just a copy of a.war and renamed just to differentiate hence
> spring.jar is same for both the applications.
>
> My question is
>
> 1) will spring.jar loaded twice
yes it will be loaded twice
> 2) how to i make sure to load it only once ( if loaded twice)
This question comes up frequently. Search the mailing list for shared
class loader to see the details. The upshot is that this can be done
using shared class loader, however there are real technical issues if
you do this - class cast exceptions, difficulty performing upgrades to
individual wars without taking down all of tomcat. The only positive
is that you might save a few MB of memory cost by having the same jar
loaded twice in memory.
I've been on this mailing list for ~8 years, and every time this
issues comes up (about 5 times a year?), the tomcat developers suggest
that the proposed memory saving isn't not worth the problems that it
causes..
HTH
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org