|
Page 2 of 2
.
.
The following example shows that when the application class-loader policy of an application server is set to MULTIPLE, each application on the server has its own class loader. An application class loader also loads its Web modules if the application's WAR class-loader policy is set to APPLICATION. If the policy is set to MODULE, then a Web module uses its own class loader.
Application class-loader policy: MULTIPLE
Application 1
.....Module: EJB1.jar
.....Module: WAR1.war
..........MANIFEST Class-Path: Dependency1.jar
..........WAR Classloader Policy = MODULE
Application 2
.....Module: EJB2.jar
..........MANIFEST Class-Path: Dependency2.jar
.....Module: WAR2.war
..........WAR Classloader Policy = APPLICATION

Class-loader modes
There are two possible values for a class-loader mode:
- PARENT_FIRST
.
The PARENT_FIRST class-loader mode 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. This is the default for class-loader policy and for standard JVM class loaders.
.
- PARENT_LAST
.
The PARENT_LAST class-loader mode causes the class loader to first attempt to load classes from its local classpath before delegating the class loading to its parent. This policy allows an application class loader to override and provide its own version of a class that exists in the parent class loader.
The following settings determine a class loader's mode:
- If the application class-loader policy of an application server is SINGLE, the application class-loader policy of an application server defines the mode for an application class loader.
.
- If the application class-loader policy of an application server is MULTIPLE, the class-loader mode of an application defines the mode for an application class loader.
.
- If the WAR class-loader policy of an application is MODULE, the WAR class-loader policy of a Web module defines the mode for a WAR class loader.
Editing a server configuration
WebSphere Studio provides you with editors so that you may change your server configurations. To edit a server configuration, you can do one of the following:
- To view the server configurations in the Server Configuration view, click the Menu icon and select View > Advanced. The advanced Server Configuration view opens, displaying the servers and their associated configurations. Double-click on the server configuration in the Server Configuration view.
.
- Right-click on the server configuration in the Server Configuration view, and then select Open. .
.
- Open with the default text editor or some other system text editor which gives you fine control over the configuration, especially for the parts of the configuration that are not supported by the Server Tools server configuration editors.
Depending on what run-time environment the server configuration is defined to use, or whether it is defined as a local or remote configuration, the fields that you can change may be different.
If you want to run several WebSphere application servers at the same time, you need to change the port settings by selecting the Ports tab located at the bottom of the WebSphere Configuration Editor. For more information about the various port settings, refer to the WebSphere Application Server documentation.
Setting class loader policy for a server
When editing a WebSphere server, you can specify the class loader isolation mode that you want to use for the application server.
1. Double-click on the server in the Server Configuration view. The server editor opens.
2. Click the Configuration tab.
3. You can specify one of the following in the Application class loader policy field:
a. SINGLE for J2EE application mode. Only one Enterprise application class loader for all applications deployed in an application server.
b. MULTIPLE for Compatibility mode. Each enterprise application gets its own application class loader.

4. Save and close the editor.
Setting class loader policy for an application on a server
You can define class loader policy for a specific application for a WebSphere test environment or server.
1. In the Server Configuration view or Servers view, double-click the server to open it. The server editor opens.
2. Click the Applications tab at the bottom of the editor.
3. In the Applications list box, select the application to modify the class loader settings.
4. In the Classloader mode field, select the class loading mode for the application:
- 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 class path.
.
- PARENT_LAST causes the class loader to attempt to load classes from its local class path before delegating the class loading to its parent.
5. In the WAR classloader policy field, select the isolation level of Web modules.
- If this policy is set to APPLICATION, then the Web project contents also are loaded by the application class loader (in addition to the EJB files, RAR files, dependency JAR files, and shared libraries).
.
- If the policy is set to MODULE, then each Web project receives its own class loader whose parent is the application class loader.

6. In the Start weight field, specify the order in which projects in an J2EE application are started. Lower weighted projects are started before higher weighted projects.
7. Save and close the editor.
_____________
Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.
Trackback(0)

|