• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Jars in Shared\lib of tomcat

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My application is referring some 3rd party jars. If i am keeping them in TOMCAT/shared/lib then my application is working fine.
Is there any way to refer these jars without putting them in server specific location. Server is shared by multiple applications and not all the applications need these jars
and moreover i will not have access to server folders on production.

Thanks,
Grishma
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe TOMCAT/shared/lib is where those jars are supposed to go. That's in contrast to TOMCAT/common/lib, which is for jars needed by the app server itself. However, you have a couple of other choices. If your multiple applications are all part of a single ear, you can put them in the ear's lib directory. If you're deploying as individual wars though, then you'd have to put them in every war's lib.
 
Saloon Keeper
Posts: 25639
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note, however, that the shared/lib directory no longer exists in Tomcat 6 and 7. It has been replaced by a single lib directory. And Tomcat 5.x is old enough you should seriously consider upgrading.

Although I don't think it's explicitly stated, there is an implicit assumption that J2EE webapps should be self-contained - part of the "write once, run anywhere" concept. Sharing a library between apps, or worse yet, sharing memory between apps, is a questionable practice. It raises the cost of maintenance to the apps, since it's a lot easier (=cheaper) to debug issues in one app as opposed to a bunch of interacting apps. And it might make it difficult to scale the apps to some other platform such as JBoss or WebSphere. Or, for that matter, to cluster Tomcat, since each instance of a cluster resides in a separate VM with a separate memory space not sharable with other instances.

Effectively, when you put a library in the Tomcat lib (or shared/lib) directory, it becomes part of the server classpath. So all resources in that library must be thread-safe or results will be unpredictable. Which is part of the higher costs I mentioned.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic