hello. working with tomcat 5.5. i have a few webapps which share a library for db connectivity, etc. so i deploy the three webapps and put the db library in shared/lib. but the webapps can't see it. when they reach that point in processing, they just stop. i've also tried common/lib - same result.
i've read documentation and many forum posts - everything says that putting it in shared/lib or common/lib is the answer - end of story. any idea why it isn't working for me?
thanks for the reply. no error, no nothing. i have log statements in both the webapp and the other libaray. i see all of the statements from the webapp - and i have something like, "instantiating CompanyProcessor..." - which should be followed by output from CompanyProcessor's constructor, but i get nothing. True what you say though - i'm not seeing any error telling me that it can't find what it's looking for either.
If i move the lib from shared/lib to the webapp's WEB-INF/lib, then it works perfectly...
Why are you putting these in shared or common lib? By the way common/lib is for libraries that both your app and Tomcat itself need to use (ie JDBC drivers used in a container managed connection pool).
There are a few nasty gotchas that can occur when you try to share libs across webapps this way.
If you have any static references in your shared libs, they will also be shared across all web apps. This can create problems when you stop, start, or redeploy an app. It can also mean that changes in one application can (unexpectedly propagate to all the other apps).
If you don't need to share these libs, you're much better off giving each application it's own copy.
Joined: Jan 12, 2004
Hello and thanks for all of the feedback. I am certain that there are no other copies of the library floating around. I'm doing this for a few reasons - the library contains a set of functions that are common to all of the webapps - so putting it in each webapp seems unnecessary. Plus if it ever does change, I'll have to change it in all three webapps. Size is another issue - it contains a few large-ish jars, hibernate, etc. So suddenly each webapp is over 10M (without the library each is around 2M). Finally, there is a configuration file in the webapp, and i'd love to have just one copy of that file instead of three.
Again, thanks to everyone for your time. Let me know if there's anything else i should be looking at...
Build tools like Ant and Maven make it very easy to manage these types of resources and having everything separate makes debugging issues like this a lot simpler.
Joined: Jan 12, 2004
I'll mention an even simpler case. I put everything in the webapp - except for the hibernate config file (must be placed in the classpath). Then I put the hibernate config file in shared/classes. When I run the app, i get an error saying that it can't find the hibernate config file. Again, I move it to the WEB-INF/classes directory and it works perfectly...