ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzamy_5.4.0.1/50/program/clsiso.htm

80 lines
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Classloader policies</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h4><A NAME="clsiso">Classloader policies</A></h4>
<p>The number and function of the application and application module classloaders depends on the classloader policies specified in the server and applcation configuration. Classloaders provide multiple options for isolating applications and modules to enable different application packaging schemes to run on an application server.</p>
<p>Two classloader policies control the isolation of applications and modules:</p>
<ul>
<li><p><strong>Application classloader policy</strong>
<br>Application classloaders consist of dependency JAR files and resource adapters. Depending on the application classloader policy, an application classloader can be shared by multiple applications (SINGLE) or unique for each application (MULTIPLE). The application classloader policy controls the isolation of applications running in the application server. When set to SINGLE, applications are not isolated. When set to MULTIPLE, applications are isolated from each other.</p>
<p>To change the application classloader policy, perform these steps in the WebSphere administrative console:</p>
<ol>
<li>Click <strong>Servers -- &gt; Application servers --&gt; <em>server_name</em></strong>.</li>
<li>Select the policy you want to use from the <strong>Application classloader policy</strong> drop-down box.</li>
<li><p>Click <strong>Apply</strong> and <strong>Save</strong>.</p></li>
</ol>
</li>
<li><p><strong>WAR classloader policy</strong>
<br>By default, Web module classloaders load the contents of the WEB-INF/classes and WEB-INF/lib directories. The application classloader is the parent of the Web module classloader. You can change the default behavior by changing the application's WAR classloader policy.</p>
<p>The WAR classloader policy controls the isolation of Web modules. If this policy is set to APPLICATION, then the Web module contents also are loaded by the application classloader (in addition to the RAR files and dependency JAR files). If the policy is set to MODULE, then each web module receives its own classloader whose parent is the application classloader.</p>
<p>To change the application's WAR classloader policy, perform these steps in the WebSphere administrative console:</p>
<ol>
<li>Click <strong>Applications -- &gt; Enterprise applications --&gt; <em>application_name</em></strong>.</li>
<li>Select the policy you want to use from the <strong>WAR classloader policy</strong> drop-down box.</li>
<li><p>Click <strong>Apply</strong> and <strong>Save</strong>.</p></li>
</ol>
</li>
</ul>
<p><strong>Note:</strong> Application client modules are not loaded by application classloaders.</p>
<p><strong>Example scenarios</strong></p>
<p>For each application server in the system, you can set the application classloader policy to SINGLE or MULTIPLE. When the application classloader policy is set to SINGLE, then a single application classloader loads all dependency JAR files in the system. When the application classloader policy is set to MULTIPLE, then each application receives its own classloader used for loading that application's dependency JAR files.</p>
<p>This application classloader can load each application's Web modules if that WAR module's classloader policy is also set to APPLICATION. If the WAR module's classloader policy is set to APPLICATION, then the application's loader loads the WAR module's classes. If the WAR classloader policy is set to MODULE, then each WAR module receives its own classloader.</p>
<p>This example shows that when the application classloader policy is set to SINGLE, a single application classloader loads all dependency JAR files of all applications on the server. The single application classloader can also load Web modules if an application has its WAR classloader policy set to APPLICATION. Applications having a WAR classloader policy set to MODULE use a separate classloader for Web modules.</p>
<pre>Application classloader policy: SINGLE
Application 1
Module: WAR1.war
MANIFEST Class-Path: Dependency1.jar
WAR Classloader Policy = MODULE
Application 2
Module: WAR2.war
WAR Classloader Policy = APPLICATION
MANIFEST Class-Path: Dependency2.jar
</pre>
<p><img src="rzamy505.gif" width="231" height="265" alt="This example shows that when the application classloader policy is set to SINGLE, a single application classloader loads all dependency JAR files of all applications on the server." border="0"></p>
<p>This example shows that when the application classloader policy of an application server is set to MULTIPLE, each application on the server has its own classloader. An application classloader also loads its Web modules if the application's WAR classloader policy is set to APPLICATION. If the policy is set to MODULE, then a Web module uses its own classloader.</p>
<pre>Application classloader policy: MULTIPLE
Application 1
Module: WAR1.war
MANIFEST Class-Path: Dependency1.jar
WAR Classloader Policy = MODULE
Application 2
Module: WAR2.war
WAR Classloader Policy = APPLICATION
MANIFEST Class-Path: Dependency2.jar</pre>
<p><img src="rzamy506.gif" width="336" height="234" alt="This example shows that when the application classloader policy of an application server is set to MULTIPLE, each application on the server has its own classloader" border="0"></p>
</body>
</html>