Class loader architecture

This section covers the class loader architecture for Apache Geronimo. The following image shows the class loader hierarchy for an application that is deployed in Apache Geronimo:

The BootStrap class loader of the JVM is followed by the Extensions class loader and then the System class loader. The j2ee-system class loader is the primary class loader of Apache Geronimo. After the j2ee-system class loader, there are multiple other layers of class loaders before reaching the application class loaders. Applications have an application class loader, which loads any required application-level libraries and EJB modules. However, the web application packaged in the EAR will have its own class loader. The Administration Console has a ClassLoader Viewer portlet that can be used to view the class loader hierarchy as well as the classes loaded by each class loader.

Modifying default class loading behavior

In certain situations, we will need to follow a class loading strategy that is different from the default one that is provided by Apache Geronimo. A common situation where we need this functionality is when a parent configuration uses a library that is also used by the child and the library used by the parent is a different version, which is incompatible with the child's version of the library. In this case, if we follow the default class loading behavior, then we will always get the classes loaded by the parent configuration and will never be able to reference the classes in the library present in the child configuration.

Apache Geronimo provides you with the ability to modify the default class loading behavior at the configuration level to handle such scenarios. This is done by providing certain elements in the deployment plan which, if present, will change the class loading behavior. These elements and the changes in class loading behavior that they represent, are explained as follows:

  • hidden-classes: This tag is used to hide classes that are loaded in parent class loaders, so that the child class loader loads its own copy. Similarly, we can use this tag to specify the resources that should be loaded from the configuration class loader. For example, consider the case where you have a module that needs to load its copy of log4j. The server also has its own copy used for logging that is loaded in the parent class loader. We can add the hidden-classes element in the deployment plan for that module so that it loads its own copy of log4j, and the server loaded version of log4j is hidden from it.

  • non-overridable-classes: This element specifies the list of classes that can be loaded only from the parent configurations of this configuration. In other words, the classes specified in this element cannot be loaded by the current configuration's class loader. The non-overridable-classes element is for preventing applications from loading their own copies of classes that should always be loaded from the parent class loaders, such as the Java EE API classes.

  • private-classes: The classes that are defined by this tag will not be visible to class loaders that are the children of the current class loader. These classes will be loaded either from the current class loader or from its parents. The same class loading behavior can be achieved by using the hidden-classes tag in all of the child class loaders.

  • inverse-classloading: If this element is specified, then the standard class loading strategy will be reversed for this module. This in effect means that a class is first looked up from the current class loader and then from its parent. Thus, the class loader hierarchy is inverted.

  • suppress-default-environment: This will suppress the environment that is created by the builder for this module or configuration. This is a rarely-used element and can have nasty side effects if it is used carelessly.

Important modules

In this section, we will list the important configurations in Apache Geronimo. We will group them according to the Apache or other open source projects that they wrap. Configurations that do not wrap any other open source project will be listed under the Geronimo section.

Apache ActiveMQ org.apache.geronimo.configs/activemq-broker/2.1.4/car
Apache Axis org.apache.geronimo.configs/axis/2.1.4/car
  org.apache.geronimo.configs/axis-deployer/2.1.4/car
Apache Axis2 org.apache.geronimo.configs/axis2-deployer/2.1.4/car
  org.apache.geronimo.configs/axis2-ejb/2.1.4/car
  org.apache.geronimo.configs/axis2-ejb-deployer/2.1.4/car
Apache CXF org.apache.geronimo.configs/cxf/2.1.4/car
  org.apache.geronimo.configs/cxf-deployer/2.1.4/car
  org.apache.geronimo.configs/cxf-ejb/2.1.4/car
  org.apache.geronimo.configs/cxf-ejb-deployer/2.1.4/car
Apache Derby org.apache.geronimo.configs/derby/2.1.4/car
Apache Geronimo org.apache.geronimo.configs/client/2.1.4/car
  org.apache.geronimo.configs/client-deployer/2.1.4/car
  org.apache.geronimo.configs/client-security/2.1.4/car
  org.apache.geronimo.configs/client-transaction/2.1.4/car
  org.apache.geronimo.configs/clustering/2.1.4/car
  org.apache.geronimo.configs/connector-deployer/2.1.4/car
  org.apache.geronimo.configs/farming/2.1.4/car
  org.apache.geronimo.configs/hot-deployer/2.1.4/car
  org.apache.geronimo.configs/j2ee-deployer/2.1.4/car
  org.apache.geronimo.configs/j2ee-server/2.1.4/car
  org.apache.geronimo.configs/javamail/2.1.4/car
  org.apache.geronimo.configs/persistence-jpa10-deployer/2.1.4/car
  org.apache.geronimo.configs/sharedlib/2.1.4/car
  org.apache.geronimo.configs/transaction/2.1.4/car
  org.apache.geronimo.configs/webservices-common/2.1.4/car
  org.apache.geronimo.framework/client-system/2.1.4/car
  org.apache.geronimo.framework/geronimo-gbean-deployer/2.1.4/car
  org.apache.geronimo.framework/j2ee-security/2.1.4/car
  org.apache.geronimo.framework/j2ee-system/2.1.4/car
  org.apache.geronimo.framework/jee-specs/2.1.4/car
  org.apache.geronimo.framework/jmx-security/2.1.4/car
  org.apache.geronimo.framework/jsr88-cli/2.1.4/car
  org.apache.geronimo.framework/jsr88-deploymentfactory/2.1.4/car
  org.apache.geronimo.framework/offline-deployer/2.1.4/car
  org.apache.geronimo.framework/online-deployer/2.1.4/car
  org.apache.geronimo.framework/plugin/2.1.4/car
  org.apache.geronimo.framework/rmi-naming/2.1.4/car
  org.apache.geronimo.framework/server-security-config/2.1.4/car
  org.apache.geronimo.framework/shutdown/2.1.4/car
  org.apache.geronimo.framework/transformer-agent/2.1.4/car
  org.apache.geronimo.framework/upgrade-cli/2.1.4/car
Apache Yoko org.apache.geronimo.configs/j2ee-corba-yoko/2.1.4/car
  org.apache.geronimo.configs/client-corba-yoko/2.1.4/car
Apache Jasper org.apache.geronimo.configs/jasper/2.1.4/car
  org.apache.geronimo.configs/jasper-deployer/2.1.4/car
JaxWS org.apache.geronimo.configs/jaxws-deployer/2.1.4/car
  org.apache.geronimo.configs/jaxws-ejb-deployer/2.1.4/car
JSR 88 org.apache.geronimo.configs/jsr88-ear-configurer/2.1.4/car
  org.apache.geronimo.configs/jsr88-jar-configurer/2.1.4/car
  org.apache.geronimo.configs/jsr88-rar-configurer/2.1.4/car
  org.apache.geronimo.configs/jsr88-war-configurer/2.1.4/car
Apache MyFaces org.apache.geronimo.configs/myfaces/2.1.4/car
  org.apache.geronimo.configs/myfaces-deployer/2.1.4/car
Apache OpenEJB org.apache.geronimo.configs/openejb/2.1.4/car
  org.apache.geronimo.configs/openejb-corba-deployer/2.1.4/car
  org.apache.geronimo.configs/openejb-deployer/2.1.4/car
Apache OpenJPA org.apache.geronimo.configs/openjpa/2.1.4/car
  
Spring org.apache.geronimo.configs/spring/2.1.4/car
Apache Tomcat6 org.apache.geronimo.configs/tomcat6/2.1.4/car
  org.apache.geronimo.configs/tomcat6-clustering-builder-wadi/2.1.4/car
  org.apache.geronimo.configs/tomcat6-clustering-wadi/2.1.4/car
  org.apache.geronimo.configs/tomcat6-deployer/2.1.4/car
  org.apache.geronimo.configs/tomcat6-no-ha/2.1.4/car
Apache WADI org.apache.geronimo.configs/wadi-clustering/2.1.4/car
GShell org.apache.geronimo.framework/gshell-framework/2.1.4/car
  org.apache.geronimo.framework/gshell-geronimo/2.1.4/car
Apache XmlBeans org.apache.geronimo.framework/xmlbeans/2.1.4/car
Apache Pluto org.apache.geronimo.plugins/pluto-support/2.1.4/car

If you check the configurations, then you will see that most of the components that make up Geronimo have a deployer configuration and a main configuration. The deployer configuration contains the GBeans that will deploy modules onto that component. For example, the openejb-deployer contains GBeans that implement the functionality to deploy an EJB module onto Apache Geronimo. For accomplishing this, the EJB JAR file and its corresponding deployment plan are parsed by the deployer and then converted into a format that can be understood by the OpenEJB subsystem. This is then deployed on the OpenEJB container. The main configuration will usually contain the GBeans that configure the container and also manage its lifecycle.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset