wood burning stoves 2.0*
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
Author

Can't add libraries to shared.loader

Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 15
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 catalina.properties 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?

Thanks,
Guy
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 15
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?

Guy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't add libraries to shared.loader
 
Similar Threads
Need help using annotations with Axis2
Including external jar in Tomcat ClassPath
what is difference between shared.loader and common.loader
java.lang.ClassNotFoundException: oracle:jdbc:driver:OracleDriver
Tomcat not resolving external repository