Hi Is it possible to have shared libs between multiple web applications (context's) in tomcat (6.0.x), where the static instances (like singletons) are not shared?
I used following feature in catalina.properties, which successfully loads the libs from the same path for each webapp: shared.loader=$INSTALL_PATH/core/conf,$INSTALL_PATH/core/*.jar,$INSTALL_PATH/core/lib/*.jar But unfortunately (for us), all the singleton objects (based on static var) are now shared too, which seems logical as the classloader probably loads only one instance of the jars/classes for the whole tomcat container. The motivation for doing this is that we have many projects on one server which run under the same tomcat, and which should run the same software/jar release (defined in shared.loader), only different configuration files. This would allow to update the software for all projects by updating the libs in our core systems, which is only installed once per server. Before we had to update each project's WEB-INF/lib separately, and over 100MB of libs were duplicated per project. Any hope achieving this easily (like configure separate classloaders?), without having to remove all singletons ? Besides, having an empty 'WEB-INF/lib' brought some other strange changes: Following code did not find property files in the Classpath (WEB-INF/classes), whereas before (with all our libs in WEB-INF/lib) it worked : InputStream propertyResource = getClass().getResourceAsStream(filename); Seems the tomcat (java?) classloader is reacting specially in that case, like shortcutting it's ressource search?! Thanks, Laurent JVM : 1.6.0 update2 OS : Windows Server 2003 Tomcat : 6.0.13