Jonas Class Loader Hierarchy; Understanding The Class Loader Hierarchy; Commons Class Loader; Application Class Loader - Red Hat APPLICATION SERVER - JONAS Manual

Jonas
Hide thumbs Also See for APPLICATION SERVER - JONAS:
Table of Contents

Advertisement

Chapter 5.

JOnAS Class Loader Hierarchy

This chapter is for the EAR application provider; that is, the person in charge of developing the J2EE
application components on the server side. It describes a new and important key feature of the J2EE
integration: the class loader hierarchy in JOnAS.

5.1. Understanding the Class Loader Hierarchy

An application is deployed by its own class loader. This means, for example, that if a WAR and an EJB
JAR are deployed separately, the classes contained in the two archives are loaded with two separate
classloaders with no hierarchy between them. Thus, the EJBs from within the JAR will not be visible
to the Web components in the WAR.
This is not acceptable in cases where the Web components of an application need to reference and use
some of the EJBs.
For this reason, prior to EAR files, when a Web application had to be deployed using EJBs, the EJB
JAR had to be located in the
directory of the Web application.
WEB-INF/lib
Currently, with the J2EE integration and the use of the EAR packaging, class visibility problems no
longer exist and the EJB JAR is no longer required to be in the
directory.
WEB-INF/lib
The following sections describe the JOnAS class loader hierarchy and explain the mechanism used to
locate the referenced classes.

5.2. Commons Class Loader

The JOnAS-specific commons class loader will load all classes and libraries required to start the
JOnAS server (that is, libraries for mail, Tomcat, etc.). This class loader has the system class loader
as parent class loader. The commons class loader adds all the common libraries required to start the
JOnAS server (J2EE applications, commons logging, ObjectWeb components, etc.); it also loads the
classes located in
.
XTRA_CLASSPATH
To have a library available for each component running inside JOnAS, add the required JAR files in the
directory or in
. The jars in
JONAS_ROOT/lib/ext
JONAS_BASE/lib/ext
JONAS_BASE/lib/ext
are loaded first, followed by the jars in
. All jars in subordinate directories
JONAS_ROOT/lib/ext
will also be loaded.
If a specific JAR is needed only for a web application (that is, you need to use a version of a JAR
file that is different than a version loaded by JOnAS), change the compliance of the web application
classloader to the Java 2 delegation model. See Section 5.6.3 WEB Class Loader.

5.3. Application Class Loader

The application class loader is a JOnAS-specific class loader that loads all application classes required
by the user applications. This implies that this loader will load all single RAR files, so all applications
have the visibility of the resource adapter's classes. This class loader has the commons class loader as
its parent class loader.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Application server

Table of Contents