Ubik Batch Server ClassLoading

From UbikWiki

Classloading (Version >= 6.0.0)

Starting from Version 6.0.0, UBIK BATCH SERVER classloading has been completely reworked to completely isolate applications (BAR) classloaders from the server CORE classloader.

To achieve this, the batch server relies on JBOSS-MODULES.


Classloading (Version < 6.0.0)

Like many server applications, the batch server installs a variety of class loaders (that is, classes that implement java.lang.ClassLoader) to allow different portions of the container to have access to different repositories of available classes and resources.In a Java environment, class loaders are arranged in a parent-child tree. Normally, when a class loader is asked to load a particular class or resource, it delegates the request to a parent class loader first, and then looks in its own repositories only if the parent class loader(s) cannot find the requested class or resource. The model for BAR class loaders differs slightly from this, as discussed below, but the main principles are the same.When batch server is started, it creates a set of class loaders that are organized into the following parent-child relationships, where the parent class loader is above the child class loader :


                Bootstrap

                    |

              batch-server-commons

              |      |  ... |

             BAR1  BAR2....BARn

As indicated in the diagram above, batch server creates the following class loaders as it is initialized :

  • Bootstrap : This class loader contains the basic runtime classes provided by the Java Virtual Machine, plus any classes from JAR files present in the System Extensions directory ($JAVA_HOME/jre/lib/ext).
  • batch-server-commons : This class loader is normally initialized from the contents of the CLASSPATH environment variable. All such classes are visible to both batch server internal classes, and to BARs.
  • BARx : A class loader is created for each BAR that is deployed batch server. All unpacked classes and resources in the /classes directory of your BAR, plus classes and resources in JAR files under the /lib directory are made visible to the containing BAR, but to no others.

As mentioned above, the BAR class loader differs from the default Java 2 delegation model : when a request to load a class from BARx class loader is processed, this class loader will look in the local repositories first, instead of delegating before looking.There are exceptions : classes which are part of the JRE base classes cannot be overriden.All other class loaders in batch server follow the usual delegation pattern.


Therefore, from the perspective of a BAR, class or resource loading looks in the following repositories, in this order :

  • Bootstrap classes of your JVM
  • /classes of your BAR
  • /lib/*.jar of your BAR
  • batch-server-commons (that contains all jar dependencies such as log4j, mx4j, etc.)

List of batch server dependencies:

  • activation-1.1.1.jar (UPGRADE)
  • antlr-2.7.6.jar
  • asm-1.5.3.jar
  • asm-attrs-1.5.3.jar
  • bcel-5.1.jar
  • bcprov-jdk14-138.jar (UPGRADE)
  • cglib-2.1.3.jar
  • commons-beanutils-1.7.0.jar
  • commons-codec-1.3.jar
  • commons-collections-3.2.jar
  • commons-dbcp-1.2.1.jar
  • commons-digester-1.8.jar
  • commons-lang-2.4.jar (UPGRADE)
  • commons-logging-1.1.jar (UPGRADE)
  • commons-mail-1.0.jar
  • commons-modeler-2.0.jar
  • commons-pool-1.2.jar
  • concurrent-1.3.4.jar
  • dom4j-1.6.1.jar
  • ehcache-1.3.0.jar
  • ejb-2.0.jar
  • fwk-do-substract-1.0.0.jar
  • geronimo-j2ee-connector_1.5_spec-1.0.jar (NEW)
  • geronimo-j2ee-management_1.0_spec-1.0.jar (NEW)
  • hibernate-3.2.6.jar (UPGRADE)
  • ibatis-common-2-2.0.jar
  • ibatis-dao-2-2.0.jar
  • ibatis-sqlmap-2-2.0.jar
  • jaas-1.0.jar
  • jaxen-1.1-beta-7.jar
  • jms-1.1.jar (NEW)
  • jmxremote-1.0.jar
  • jmxri-1.2.1.jar
  • jta-1.0.1.jar
  • log4j-1.2.15.jar (UPGRADE)
  • mail-1.4.1.jar (UPGRADE)
  • mx4j-tools-3.0.2.jar (UPGRADE)
  • naming-common-1.1.jar
  • naming-factory-1.1.jar
  • naming-resources-1.1.jar
  • quartz-1.5.2.jar
  • quickserver-1.4.7.jar
  • servletapi-2.3.jar
  • ubik-batch-server-jms-5.0.1.0.jar (NEW)
  • ubik-console-5.0.1.0.jar (UPGRADE)
  • ubik-console-config-5.0.1.0.jar (UPGRADE)
  • ubik-console-logging-5.0.1.0.jar (UPGRADE)
  • ubik-console-persister.1.0.2.jar (UPGRADE)
  • ubik-console-shared-data-5.0.1.0.jar (UPGRADE)
  • ubik-console-transfer-5.0.1.0.jar (UPGRADE)
  • ubik-fwk-1.0.jar
  • velocity-1.4.jar
  • xerces-resolver-2.8.1.jar (NEW)
  • xercesImpl-2.8.1.jar (UPGRADE)
  • xml-apis-1.3.03.jar (UPGRADE)
Personal tools