Thank you Mark for your valuable inputs. They are indeed a great help. Thanks, Amit
On 15/06/16 7:00 pm, "Mark Thomas" <ma...@apache.org> wrote: >On 15/06/2016 12:03, Amit Pande wrote: >> >> >> On 15/06/16 4:06 pm, "Mark Thomas" <ma...@apache.org> wrote: >> >>> On 15/06/2016 11:00, Amit Pande wrote: >>>> We develop multiple web application which happen to share the same >>>> stack (Spring, Hibernate,etc). >>>> >>>> Thinking of sharing these third party libraries instead of duplicating >>>> in each web app war. >>> >>> Why? >> To avoid jar duplication and improve memory footprint > >Is memory footprint really that much of an issue? > >>>> IIUC, putting those in Tomcat (8)'s lib folder might cause issues >>>>since >>>> the classes in there are loaded by a common loader. >>> >>> What issues? >> Since loaded by a common class loader , the jars put in here will be >> available to tomcat internal classes,even if not required , also need be >> to thread safe. > >What is the harm in these classes being visible to Tomcat? > >I fail to see what thread-safety has to do with this. > >You do need to think about memory leaks though. > >>>> And sharing such libraries using the shared loader seems a better >>>> approach. >>> >>> Why? >> As loaded by shared loader which seems to be meant for sharing >> libraries across web apps ŠI guess here also the thread safely concern >> exists , need to validate though. > >As above, thread-safety is not a relevant concern. > >>>> Is my understanding correct ? >>> >>> No idea. You have not explained your understanding yet. >> Hope it is explained now. > >It has. And your understanding, particularly around thread safety is not >correct. > >>>> Does it have any further issues ? >>> >>> Further issues compared to what? >> It was a general awareness question to get to know if people ran into >> some issues after putting jars in tomcat¹s shared loader's path. > >It increases the risk of issues due to: >- memory leaks since few libraries are written with a multi-class loader >environment in mind >- upgrades are harder since you have to take Tomcat down to upgrade any >shared library >- dependency management is harder since all webapps have to use the same >set of dependencies > >>>> That said, I don't see much documentation around using shared loader. >>>> Any documentation/help in this regard is highly appreciated. >>> >>> There isn't much call for the shared loader. You need to go back to the >>> 5.5.x documentation for a diagram that includes the shared loader. >>> >>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html >> >> Thanks for this. In absence of clear documentation in recent release, I >> was doubtful if it was deprecated. > >Not deprecated. Just rarely useful so disabled by default. > >Generally, it causes more problems than it solves so unless you are >really under memory pressure it isn't worth the trouble. > >Mark > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >For additional commands, e-mail: users-h...@tomcat.apache.org >