Show TOC

Using Heavy Class LoadersLocate this document in the navigation structure

Use

Besides the standard class loader, an application can also have a heavy class loader. Its purpose is to load classes bundled into the application archive with higher priority, before all other resources referenced by the application or provided by the application server.

Overview

Heavy loaders work in the following manner:

  • Heavy class loaders are created with the resources located in the lib folder in the root of the EAR/SDA or in the folder defined as a value of XML tag <library-directory> in the application.xml deployment descriptor .

  • A heavy class loader is the first in the list of parent class loaders of the application class loader. This guarantees the following delegation order when loading a resource:

    • Heavy loader (and its parent, respectively)

    • Default references, defined in the Deploy service property StandardApplicationReferences . For example, some Java EE APIs and implementations provided by AS Java.

    • Application specific references (specified in the application-j2ee-engine.xml )

    • All other application resources contained in the EAR.

Procedure

To make use of the heavy class loaders, follow the steps:

  1. Assemble the heavy resources in the lib folder or in a folder which is defined as a value of XML tag <library-directory> in the application.xml deployment descriptor .

    Note

    If the application version is older than Java EE 5, the heavy class loader should be enabled by specifying an empty XML tag <enableHeavyClassloadingBeforeJavaEE5/> in the META-INF\applicaton-service.xml file.

  2. Deploy your application.