Humble apologies, I have not seen changes to the lib structures for any of the 
tomcat releases I have used and that spans back 5 years or more     (well OK, 
at one point symbolic links worked, now they don't unless I change the xml 
Thanks for the answer. I would have moved the jaybird thing only so WAR files 
included it, but it sounds like a bad idea if clobbers connection pools - 
thought there was ONE pool per application.
Agreed to leave all else as is, the hard link solution solves the problem of 
multiple copies nicely. Just cannot do that in Microsoft land, but that is OK 
as all Microsoft versions I support only have one application running.
Many thanks - I understand better why things are as they are.

     On Tuesday, June 2, 2015 10:10 AM, Mark Thomas <> wrote:

 On 02/06/2015 14:52, David kerber wrote:
> On 6/2/2015 9:11 AM, Ray Holme wrote:
>> Currently using apache-tomcat-7.0.35. Not sure that matters as no
>> behavior has changed in prior releases.

That kind of response when asked for further information - especially
when the information is as basic as which Tomcat version is being used
(you failed to give any indication of the Tomcat version you are using
and we see questions from folks using Tomcat 3 all the way up to the
unreleased Tomcat 9) - is very frustrating for those of us trying to
help and does nothing to encourage us to continue to help.

> It does matter, because the directory layouts have changed in the
> various major versions.

It also matters since later versions of Tomcat are more relaxed about
where they will load JDBC drivers from.

>>      On Tuesday, June 2, 2015 8:56 AM, Mark Thomas <>
>> wrote:
>>  On 02/06/2015 12:42, Ray Holme wrote:
>>> I have been using tomcat for a while and have several applications.
>>> Some jar files are specific to an application and make sense to be in
>>> .../webapps/APPLICATION/WEB-INF/lib and some are used in multiple
>>> applications so they need to appear in each applications lib. One
>>> shared jar file is my own common code, but then there are many things
>>> that are pulled from the net (e.g. mail.jar). In addition I put one
>>> jar file in the top tomcate ../lib directory as it is used by
>>> everything for DB access (jaybird...jar in my case.
>>> Since I use Linux, ALL of these extra jar files are maintained
>>> somewhere else (same linux file system required) and I hard link them
>>> to the above named places so I don't need multiple copies and one
>>> update serves all (with a web restart, natch).
>>> So, here are my questions: 1) Is there any reason why the SQL library
>>> (jaybird above) needs to be in the .../lib (top tomcat directory) or
>>> could it be in the WEB-INF/lib directory too?

Yes. It needs to be in $CATALINA_BASE/lib so it is visible to the
connection pool implementation.

Putting another copy in WEB-INF/lib is theoretically safe (it should be
a NO-OP) but can often trigger class loading issues (if the app refers
to any of the classes in the JAR directly).

See the Tomcat 8 migration guide for how this changes in 8.0.x.

>>> If the latter is OK,
>>> then it becomes part of the WAR file when I distribute and thus saves
>>> an extra step when this jar updates. Also, by putting it (logically)
>>> there in the application lib(s), it evokes more security if I
>>> understand the purpose of doing this (see next question).
>>> 2) Could I also put my own common jar file in the top tomcat .../lib
>>> directory? I am confident that it does NOT have insecure code so
>>> logic says it could be there, but having it in the WAR file might be
>>> a better option anyway as I do add things to it. In other words, if I
>>> were confident in the source for say mail.jar and knew it was secure,
>>> it too could be in the top directory (with the caveat that it no
>>> longer is in the WAR file).

Yes you can put your own JARs in $CATALINA_BASE/lib but beware of issues
with singletons, caches etc. The downside is that it makes it impossible
to use different versions of your JAR with different web applications
(unless you put the classes in different packages) which typically
forces you to upgrade all your applications at the same time.

>>> Question 1 would be useful as it makes distributions more easy and
>>> totally effective if all can be in the WAR file. Question 2 is just
>>> for me to understand better how tomcat works - I don't think I want
>>> to move the application jars to the tomcat lib.
>>> Many thanks for improving my understanding.

Personally, I'd would:
- aim to keep my web applications dependencies to a minimum
- package all the dependencies in WEB-INF/lib


To unsubscribe, e-mail:
For additional commands, e-mail:


Reply via email to