Hi Chris,
Here is the reference to the Tomcat documentation that explains how
class loaders work in Tomcat, and the relationship between the different
shared library directories :
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
This should help you understand the behaviour. Also note that if you
have the same library at multiple locations but in *different versions*
(for example Log4J), you might run into some unexpected behaviour.
Regards,
Serge Huber.
chris markiewicz wrote:
Hello.
I have a handful of webapps which use a JAR that I created. This JAR
depends on a handful of other JARs, etc etc. Essentially I want my webapps
to be able to use this JAR - without putting the JAR into the individual
webapps.
I originally put my JAR and other related JARs into the shared/lib/
directory - but my webapps could still not see my JAR. I moved my JAR into
common/lib/, and this improved things slightly - but it couldn't see some of
its dependencies, so I moved them too. Still getting some visibility errors
though.
Finally, I moved my JAR (but not its dependencies) into the lib/ directory
of an individual webapp, and everything works perfectly.
I've done some research and I read that the shared/lib/ directory is visible
to the webapps, but not the container. Additionally, the common/lib/
directory is visible to webapps AND the container.
I have several questions. First, is the preceding paragraph (visibility of
those directories) correct, within the context of Jahia?
Second, my error seems very clearly to be a visibility issue. My current
guess is that there is something in my shared/lib/ directory that needs to
be in my common/lib directory. Does this sound correct? (Obviously this is
something I can test - and I am testing, but moving jars is a slow process,
involving a restart, etc).
Finally, generally speaking, what is the common practice for the placement
of these dependencies?
Thanks for your time.
Chris