File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Can't add libraries to shared.loader 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

Can't add libraries to shared.loader

Guy Yafe

Joined: Sep 30, 2011
Posts: 24
Hi all,
I am using the latest Tomcat version: 7.0.30.
I want to add an external library to the class loader, so web applications can use other classes I have written.
I tried adding the path to the shared.loader property in the file, and Tomcat just ignored this property and did not load my classes.
When I added the same path to the common.loader proprty, it worked perfectky and Tomcat loaded all my classes and the application worked well.

Has anyone encountered this problem before?
Is there another property I should set? Maybe I need to explicitly tell Tomcat to use the shared loader?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Actually, sharing classes between webapps is not a recommended practice. Webapps are supposed to be self-contained for one thing. Plus a lot of people who try don't address proper thread-safety in their libraries, and shared classes MUST allow for unexpected multi-threading issues.

An IDE is no substitute for an Intelligent Developer.
Guy Yafe

Joined: Sep 30, 2011
Posts: 24
Thanks, I am aware of this approach.
Still, I want to have some common libraries for all my applications: User managment (Like BaseUser object) and some Logging utilities.
Is there a way to put these libraries inside the shares.loader property instead of the common.loader?

I agree. Here's the link:
subject: Can't add libraries to shared.loader
It's not a secret anymore!