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? 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).
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.

Reply via email to