aspose file tools*
The moose likes Tomcat and the fly likes can't find libraries in shared/lib? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "can Watch "can New topic
Author

can't find libraries in shared/lib?

chris markiewicz
Greenhorn

Joined: Jan 12, 2004
Posts: 4
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?

any help is greatly appreciated.
thanks
chris
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Originally posted by chris markiewicz:
when they reach that point in processing, they just stop.


"Just stopping" is not generally a sign of a missing library.

What do you mean by "just stop"? Hanging? Not completing a request? Any errors in the logs?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
chris markiewicz
Greenhorn

Joined: Jan 12, 2004
Posts: 4
bear -

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...

thanks again
chris
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Originally posted by chris markiewicz:
If i move the lib from shared/lib to the webapp's WEB-INF/lib, then it works perfectly...


That is odd. Are you sure there's no older version of the library in WEB-INF/lib that might block seeing it in common? (grasping at straws here)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.
chris markiewicz
Greenhorn

Joined: Jan 12, 2004
Posts: 4
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...

Chris
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.
chris markiewicz
Greenhorn

Joined: Jan 12, 2004
Posts: 4
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...

thanks again for your time.
chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't find libraries in shared/lib?