File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Does Tomcat load classes twice when they are in different apps? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Does Tomcat load classes twice when they are in different apps?" Watch "Does Tomcat load classes twice when they are in different apps?" New topic
Author

Does Tomcat load classes twice when they are in different apps?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi there,
just a question for my understanding: We use a little framework for our apps (comes with a lot from the Apache site and some stuff from a vendor and some stuff from us). So all apps share 80% of the classes used.
When creating the WAR file I always include the full set of classes, since I can't know if the stuff is already there. In terms of diskspace that is stupid (however how many GB can you buy for 1h of tech-support ;-) ).
Is it also stupid in terms of resource useage? Will Tomcat (5) load a class twice if it is identical, but stored twice in different directories?
I know we could deploy the common classes into /common/lib. But then we might interfere with other apps?
What is a good deployment strategy. I think if Tomcat is smart enough about the classes, our current approach is fair enough?
;-) stw
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
There is a discussion of classloaders in Tomcat 5 here.
It looks to me like that page covers your question.
Bill
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi William,
thx for the URL... and shame on me, I've overlooked the ..How To page!
;-) stw
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does Tomcat load classes twice when they are in different apps?