JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Application Development Guide
search filter icon
search icon

Document Information


Part I Development Tasks and Tools

1.  Setting Up a Development Environment

2.  Class Loaders

The Class Loader Hierarchy


Using the Java Optional Package Mechanism

Using the Endorsed Standards Override Mechanism

Class Loader Universes

Application-Specific Class Loading

Circumventing Class Loader Isolation

Using the Common Class Loader

Sharing Libraries Across a Cluster

Packaging the Client JAR for One Application in Another Application

To Package the Client JAR for One Application in Another Application

3.  Debugging Applications

Part II Developing Applications and Application Components

4.  Securing Applications

5.  Developing Web Services

6.  Using the Java Persistence API

7.  Developing Web Applications

8.  Using Enterprise JavaBeans Technology

9.  Using Container-Managed Persistence

10.  Developing Java Clients

11.  Developing Connectors

12.  Developing Lifecycle Listeners

13.  Developing OSGi-enabled Java EE Applications

Part III Using Services and APIs

14.  Using the JDBC API for Database Access

15.  Using the Transaction Service

16.  Using the Java Naming and Directory Interface

17.  Using the Java Message Service

18.  Using the JavaMail API


The Class Loader Hierarchy

Class loaders in the GlassFish Server runtime follow a delegation hierarchy that is fully described in Table 2-1.

The following table describes the class loaders in the GlassFish Server.

Table 2-1 Oracle GlassFish Server Class Loaders

Class Loader
The Bootstrap class loader loads the basic runtime classes provided by the JVM software.
The Extension class loader loads classes from JAR files present in the system extensions directory, domain-dir/lib/ext. It is parent to the Public API class loader. See Using the Java Optional Package Mechanism.
Public API
The Public API class loader makes available all classes specifically exported by the GlassFish Server runtime for use by deployed applications. This includes, but is not limited to, Java EE APIs and other Oracle APIs. It is parent to the Common class loader.
The Common class loader loads JAR files in the as-install/lib directory, then classes in the domain-dir/lib/classes directory, followed by JAR files in the domain-dir/lib directory. Using domain-dir/lib/classes or domain-dir/lib is recommended whenever possible, and required for custom login modules and realms. It is parent to the Connector class loader. See Using the Common Class Loader.
The Connector class loader is a single class loader instance that loads individually deployed connector modules, which are shared across all applications. It is parent to the Applib class loader and the LifeCycleModule class loader.
The LifeCycleModule class loader is created once per lifecycle module. Each lifecycle module’s classpath is used to construct its own class loader. For more information on lifecycle modules, see Chapter 12, Developing Lifecycle Listeners.
The Applib class loader loads the library classes, specified during deployment, for a specific enabled module or Java EE application; see Application-Specific Class Loading. One instance of this class loader is present in each class loader universe; see Class Loader Universes. It is parent to the Archive class loader.

When multiple deployed applications use the same library, they share the same instance of the library. One library cannot reference classes from another library.

The Archive class loader loads classes from the WAR, EAR, and JAR files or directories (for directory deployment) of applications or modules deployed to the GlassFish Server. This class loader also loads any application-specific classes generated by the GlassFish Server runtime, such as stub classes or servlets generated by JSP pages.