I know that hierarchy of class loaders in java is :
1.Bootstrap class loader (in native code)
2. Extension class loader (sun.misc.Launcher$ExtClassLoader
)
3. System class loader (sun.misc.Launcher$AppClassLoader class
)
4. Custom class loaders (i.e. app server, ear classloader, war classloader)
It is not clear for me why additional child class loaders are needed. I could understand the need for 'pure java' class loader after the one in native code.
I have some thoughts of possible reasons but can someone provide me with clear explanation for this behavior / need for hierarchies of class loaders?
In general but applicable for j2ee as well.
Classloaders are useful for providing a variety of behavior and for protecting different Java programs running in the same VM from each other. There are three major categories that come to mind:
war
s might be installed that all have different versions of a library (say, Apache Commons-Lang). OSGi also uses this approach to ensure that each bundle can only access the classes it's specifically requested and can't "leak" API.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With