I see by your paths that you are an MS person. Your solution is clever but has 
the distribution problem that a war file may not be enough.
For Unix based folks (MAC, Linux), there is a much easier solution. Put your 
common jars in some directory that you like (for me /opt/web_jars/acquired). 
Then HARD link the jars to where you want them e.g.   ln 
/opt/web_jars/acquired/commons-logging-1.2.jar 
/opt/apache/webapps/application/WEB-INF/libThis does not solve the problem for 
a target machine running multiple applications, but it sure does solve the 
problem for a development machine with multiple applications and target 
machines running any one of them. War files work fine.
Your solution does have one major advantage - war fles are smaller.But if you 
change any of those jars, you need to distribute those changes and the war file 
does NOT do it.!
 

    On Saturday, November 25, 2017 9:35 AM, "rich...@xentu.com" 
<rich...@xentu.com> wrote:
 

 I've written a few jersey webapps, and each has about 20 jar files 
included as Maven dependencies.

The inclusion of those jars increases the size of the resulting wars by 
a factor of over 100. Uploading a war via 'Tomcat Web Application 
Manager' takes several minutes, presumably due in part to the war size.

Given that these webapps require the same set of jars in their 
WEB-INF/lib/, I thought I could place them in say

C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jersey

where all webapps could find them.

In catalina.properties, I appended this new directory to the 
common.loader list of paths:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,
 
${catalina.base}/lib/jersey/*.jar

Then, in each jersey webapp, I'd modify pom.xml to exclude those files 
from the war.

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <version>3.2.0</version>
  <configuration>
    <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
  </configuration>
</plugin>

This approach seems to work.

So, the question I'm seeking advise on is this:

If I have a collection of jars that I want to keep on Tomcat, for some 
but not all webapps, and those jars are not to be included in the wars, 
is this an acceptable technique? Or is it going to land me in trouble? 
Does the order of locations in common.loader matter?


Thanks for any advice
Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



   

Reply via email to