I know that Tomcat uses classloaders to partition webapps, and that the webapp classloader in Tomcat overrides the default classloader behaviour, so that it checks locally for classes and only delegates to the parent classloader if it can't find it.
Knowing this I'm sure that Tomcat will ensure that classes within a .war file is only available to that webapp, since it will be loaded by that classloader.
What I'm not sure about is how Tomcat partitions the core classes, if at all.
I know that Java's core classes are loaded by the Bootstrap class loader.
However, if the webapp classloader trys to load required classes itself first, does this mean the webapp classloader will load the core classes itself?
What I'd like to know is Does Tomcat's classloader hierarchy ensure core Java classes are separately loaded for eac开发者_C百科h webapp, or are they shared between webapps?
If by core class files you are referring to the installed JRE, tomcat shares those with all the webapps.
The separate class loading applies only to the jar files that are placed inside each webapp lib directory.
Even the jar files that are placed under tomcat lib directory are shared between all applications.
精彩评论