Reputation: 999
I made search on subject, but didn't find anything easy to understand... We have a tomcat (v5.5). There is many webapp deployed on it. Each webapp has all librairies in the WEB-INF/lib directory. So there is a lot of duplication.
A classic library (XXX_API) was created in order to organize some common methods. So this librairy is added in each webapp to compile but not deployed with them. This librairy is deployed in shared directory of Tomcat.
We tried to integrate some DAO using JdbcTemplate of Spring 3.1.1 in the common librairy. So we had to deploy Spring librairies in shared directory in order to deploy our XXX_API.
Now, we can't launch all applications. Some of them crashed with these exception : java.lang.IllegalArgumentException. Class org.springframework.jdbc.config.JdbcNamespaceHandler does not implement the NamespaceHandler interface. For information, they are developped with Spring 2.0.6 :(
The problem seems to be localized in the applicationContext.xml.
So, here my questions :
Thank you.
Upvotes: 0
Views: 2868
Reputation: 999
So, i have deleted all spring jars in each web application. I imported the spring lib (3.1.1) present in shared directory. And i unchecked them (under netbeans) to not have them in the build.
I even changed the declaration in web.xml, applicationContext.xml and Spring Servlet in order to be standardized with servlet v2.5.
All seems to be fine now...
Upvotes: 0
Reputation: 11805
The main use that i've seen for the shared lib folder is for things like jdbc drivers, jta transaction managers and other infrastructure like things that:
I wouldn't go putting actual app libraries like spring in the shared lib folder.
Upvotes: 1
Reputation: 45433
Probably because one class is loaded by app classloader, another by shared classloader.
Save yourself the trouble, don't use shared directory. What for? To save some disk space?
Upvotes: 0
Reputation: 7519
What you are really asking is how the classloaders load, in what sequence, etc. This page explains all of the classloaders that are involved in a webapp's execution inside of the tomcat container quite well. It tells where they look for classes, in what sequence, and which classes can be seen by each webapp as well as the container itself. Note, changes to this are significant across tomcat versions.
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
Upvotes: 2