geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <>
Subject Re: Struts on Geronimo
Date Tue, 28 Sep 2004 23:45:41 GMT
Stephen Kong wrote:
> If you have two web applications both using struts, you may put the 
> struts jars in a common lib directory, otherwise, your jars will be 
> picked up twice.
> If I'm wrong please correct me.

We don't have a common lib directory per se; we do something similar but 

The simplest model is you place the struts jar in the WEB-INF/lib 
directory of each war. Each one will then see different copies of the 
jar - which may be desirable, for example if they were written against 
different versions of struts.

If you only want one copy in the deployment, a spec compliant option is 
to place both wars in an ear and use a manifest Class-Path entry in each 
war to reference it. However, the jar will still be loaded twice as the 
two wars will have difference classloaders.

Another option is to add the jar to the extension directory of the app 
server; a bit like the common and shared directories in Tomcat. This has 
the downside of making available to every application, even those that 
don't use struts.

In Geronimo there are a couple of other alternatives. The easiest is to 
use a <dependency> element in the deployment plan (aka vendor deployment 
descriptor) to specify a file located in the server's repository. For 
example, you could add


to include struts-1.2.jar on the ear or war classpath.

If you need to do this a lot, you can build a custom configuration which 
defines dependencies on all the jars you use. Then, in your application 
plan, you make it a child of that configuration rather than the default 
which will make all those jars available to it.

With either of these, you don't need to include the jars inside your 

The intention is to give you control over exactly which classes from 
which classloader get loaded into your application, whilst at the same 
time allowing applications to use different versions as needed.

Hope this helps

View raw message