Geronimo Architecture: Part 2

0
108
9 min read

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:

Apache Geronimo 2.1: Quick Reference

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/activemqbroker/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-gbeandeployer/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-securityconfig/2.1.4/car

org.apache.geronimo.framework/shutdown/2.1.4/car

org.apache.geronimo.framework/transformeragent/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-earconfigurer/2.1.4/car

org.apache.geronimo.configs/jsr88-jarconfigurer/2.1.4/car

org.apache.geronimo.configs/jsr88-rarconfigurer/2.1.4/car

org.apache.geronimo.configs/jsr88-warconfigurer/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-corbadeployer/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-clusteringbuilder-wadi/2.1.4/car

org.apache.geronimo.configs/tomcat6-clusteringwadi/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.

Server directory structure

It is important for a user or an administrator to understand the directory structure of a Geronimo server installation. The directory structure of a v2.1.4 server is shown in the following screenshot:

Apache Geronimo 2.1: Quick Reference

Please note that the directory that we will be referring to as <GERONIMO_HOME> is the geronimo-tomcat6-javaee5-2.1.4 directory shown in the screenshot.

The following are some important directories that you should be familiar with:

  • The bin directory contains the command scripts and the JAR files required to start the server, stop the server, invoke the deployer, and start the GShell.
  • The etc directory contains the configuration files for GShell.
  • The schema directory contains Geronimo schemas.
  • The var/config directory contains Geronimo configurations files. A Geronimo administrator or user can find most of the configuration information about the server here.
  • The var/derby directory contains the database files for the embedded Derby database server.
  • The var/log directory contains logging configuration and logfiles.
  • The var/security directory contains user credential and grouping files.
  • The var/security/keystores directory contains the cryptographic keystore files used for server SSL configuration.

The following are some important configuration files under the Geronimo directory structure:

  • config.xml: This file is located under the &ltGERONIMO_HOME>/var/config directory. This file preserves the information regarding GBean attributes and references that were overridden from the default values used at deployment time.
  • config-substitutions.properties: This file is located under the &ltGERONIMO_HOME>/var/config directory. The property values specified in this file are used in expressions in config.xml. The property values in this file can be overridden by using a system property or environment variable with a property name that is prefixed with org.apache.geronimo.config.substitution.
  • artifact_aliases.properties: This file is located under the &ltGERONIMO_HOME>/var/config directory. This file is used to substitute one module or configuration ID for another module or configuration ID. The entries in this file are of the form oldArtifactId=newArtifactId, for example default/mylib//jar=default/mylib/2.0/jar. Note that the version number in the old artifact ID may be omitted, but the version number in the new artifact ID must be specified.
  • client_artifact_aliases.properties: This file is located under the &ltGERONIMO_HOME>/var/config directory. This file is used for artifact aliasing with application clients.
  • server-log4j.properties: This file is located under the &ltGERONIMO_HOME>/var/log directory. This file contains the logging configuration for the server.
  • deployer-log4j.properties: This file is located under the &ltGERONIMO_HOME>/var/log directory. This file contains the logging configuration for the deployer.
  • client-log4j.properties: This file is located under the &ltGERONIMO_HOME>/var/log directory. This file contains the logging configuration for application clients.
  • users.properties: This file is located under the &ltGERONIMO_HOME>/var/security directory. This file contains the authentication credentials for the server.
  • groups.properties: This file is located under the &ltGERONIMO_HOME>/var/security directory. This file contains the grouping information for the users defined in users.properties

Among the directories that contain sensitive information, such as user passwords, are var/security, var/derby, and var/config. These directories should be protected using operating system provided directory and file security.

LEAVE A REPLY

Please enter your comment!
Please enter your name here