Class loading

Class loaders affect the packaging of applications and the run-time behavior of packaged applications deployed on appservers.

  1. Read about class loaders.

  2. If necessary, migrate class-loader Module Visibility Mode settings for Version 4.0.x applications to V5 application or WAR class-loader policies.

  3. If an application module uses a resource, create a resource provider that specifies the directory name of the resource drivers. Do not specify the resource JAR file names. All JAR files in the specified directory will be added into the class path of the WAS extensions class loader.

  4. Configure class loaders of an appserver for the run-time environment.

    1. Click Servers > Application Servers > server and, on the settings page for an appserver, set the application class-loader policy and application class-loader mode.

      The application class-loader policy controls the isolation of applications running in the system. When set to SINGLE, applications are not isolated; a single application class loader is used to contain all EJB modules, dependency JAR files, and shared libraries in the system. When set to MULTIPLE, applications are isolated from each other; each application receives its own class loader to load that application's EJB modules, dependency JAR files, and shared libraries.

      The application class-loader mode specifies the class-loader mode when the application class-loader policy is SINGLE. PARENT_FIRST causes the class loader to first delegate the loading of classes to its parent class loader before attempting to load the class from its local class path. PARENT_LAST causes the class loader to first attempt to load classes from its local class path before delegating the class loading to its parent. This allows an application class loader to override and provide its own version of a class that exists in the parent class loader.

    2. On the settings page for an appserver, click Classloader. On the Classloader page, click New.

    3. On the settings page for a class loader, specify the class-loader mode. PARENT_FIRST causes the class loader to delegate the loading of classes to its parent class loader before attempting to load the class from its local classpath. PARENT_LAST causes the class loader to attempt to load classes from its local class path before delegating the class loading to its parent. Then, click OK.

    4. On the settings page for a class loader, click Libraries. From the Library Ref page, click Add. On the settings page for a library reference, specify variables for the library reference as needed and click OK. Repeat the previous step until you define a library reference instance for each library file that your application needs. To define a library reference, first define one or more shared libraries.

  5. When configuring an installed enterprise application for deployment in the run-time environment, set the class-loader mode and the WAR class-loader policy.

  6. When configuring an installed Web module for deployment in the run-time environment, set the class-loader mode.

 

See Also

Class loaders
J2EE application client class loading
Shared library files
Assembling applications with the Assembly Toolkit
Class loader collection
Enterprise application settings
Web Module Deployment settings