Class loading
Class loaders affect the packaging of applications and the run-time behavior of packaged applications deployed on appservers.
- Read about class loaders. The article "Class loading: Links" points to additional sources.
- If necessary, migrate class-loader Module Visibility Mode settings for Version 4.0.x applications to Version 5.0 application or WAR class-loader policies.
- When assembling an enterprise application resource file that has EJB modules, set the classpath for the class loader to use during packaging.
- (Optional) 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 classpath of the WebSphere Application Server extensions class loader.
- Configure class loaders of an appserver for the run-time environment.
- Click Servers > Application Servers > server_name 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 classpath. PARENT_LAST causes the class loader to first attempt to load classes from its local classpath 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.
- On the settings page for an appserver, click Classloader. On the Classloader page, click New.
- 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 classpath before delegating the class loading to its parent. Then, click OK.
- (Optional) 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.
- When configuring an installed Web module for deployment in the run-time environment, set the class-loader mode.
Class loaders
J2EE application client class loading
Shared library files
Assembling new or modifying existing modules
Class loader collection
Enterprise application settings
Web Module Deployment settings
Class loading: Links