J2EE classloader

  • Above System-Classpath classloader: Children can see parent.
  • Below System-Classpath classloader: Children can see parent only if it is mentioned in MANIFEST.MF
J2EE application specific class loaders are children of the System-Classpath classloader. This class loader is responsible for loading all the dependency jar files (log4j, util.jar, common.jar), which are shared by both WEB and EJB modules. So if EJB.jar wants to refer to Common.jar and Util.jar we need to add them (space delimited) to class-path in EJB.jar’s manifest file MANIFEST.MF.
As a general rule classes should not be deployed higher in the hierarchy than they are supposed to exist. This is because if you move one class up the hierarchy then you will have to move other classes up the hierarchy as well. This is because classes loaded by the parent class loader can’t see the classes loaded by its child class loaders (uni-directional bottom-up visibility).