69 lines
6.2 KiB
HTML
69 lines
6.2 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>Administer classloaders using the WebSphere administrative console</title>
|
||
|
</head>
|
||
|
|
||
|
<BODY>
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
<h4><A NAME="clsadmcns"></A>Administer classloaders using the WebSphere administrative console</h4>
|
||
|
<p><strong>Classloader modes</strong></p>
|
||
|
<p>There are two possible values for a classloader mode. These values can be changed using the WebSphere administrative console.</p>
|
||
|
<ul>
|
||
|
<li><p><strong>PARENT_FIRST</strong>
|
||
|
<br>The PARENT_FIRST classloader mode causes the classloader to first delegate the loading of classes to its parent classloader (the classloader up one level in the classloader hierarchy) before attempting to load the class from its local classpath. This is the default classloader policy for all classloaders. This default can be changed for the classloaders supplied by the WebSphere run time. It can not be changed for the Java Virtual Machine classloaders.</p></li>
|
||
|
<li><p><strong>PARENT_LAST</strong>
|
||
|
<br>The PARENT_LAST classloader mode causes the classloader (the classloader up one level in the classloader hierarchy) to first attempt to load classes from its local classpath before delegating the classloading to its parent. This policy allows an application classloader to override and provide its own version of a class that exists in the parent classloader.</p></li>
|
||
|
</ul>
|
||
|
<p>There are three Classloader mode settings:</p>
|
||
|
<ul>
|
||
|
<li>on an application server</li>
|
||
|
<li>on an application</li>
|
||
|
<li>on a web module</li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
<p>There are several classloader policy and classloader mode settings in the WebSphere administrative console. See the topics below for more information:</p>
|
||
|
|
||
|
<p><strong>Setting classloaders in application servers</strong></p>
|
||
|
|
||
|
<p>Click <strong>Servers --> Application Servers --> <em>server_name</em></strong> and, on the settings page for an application server, set the application classloader policy and application class loading mode. </p>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>The <strong>Application classloader policy</strong> controls the isolation of applications running in the system. When set to SINGLE, applications are not isolated; a single application classloader is used to contain all dependency JAR files in the system. When set to MULTIPLE, applications are isolated from each other; each application receives its own classloader to load that application's dependency JAR files.</p></li>
|
||
|
|
||
|
<li><p>The <strong>Application classloader mode</strong> specifies the classloader mode when the application classloader policy is SINGLE. This field is not used if the application classloader policy is MULTIPLE. PARENT_FIRST causes the classloader to first delegate the loading of classes to its parent classloader before attempting to load the class from its local classpath. PARENT_LAST causes the classloader to first attempt to load classes from its local classpath before delegating the classloading to its parent. This allows an application classloader to override and provide its own version of a class that exists in the parent classloader.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>Setting classloaders in an application</strong></p>
|
||
|
|
||
|
<p>Click <strong>Applications --> Enterprise Applications --> <em>application_name</em></strong> and, on the settings page for an application server, set the WAR classloader policy and application classloading mode.</p>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>The <strong>WAR classloader policy</strong> specifies whether to use the application classloader to load all WAR files of this application or to use a separate classloader for each WAR file. 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></li>
|
||
|
|
||
|
<li><p>The <strong>application classloading mode</strong> specifies whether the classloader searches in the parent classloader or in the application classloader first to load a class. The standard for JDK classloaders and WebSphere Application Server classloaders is PARENT_FIRST. By specifying PARENT_LAST, your application can override classes contained in the parent classloader, but this action can potentially result in ClassCastException or LinkageErrors if you have mixed use of overridden classes and non-overridden classes.</p>
|
||
|
|
||
|
<p>The options are PARENT_FIRST and PARENT_LAST. The default is to search in the parent classloader before searching in the application classloader to load a class.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
<p><strong>Setting classloaders in a Web module</strong></p>
|
||
|
|
||
|
<p>Click <strong>Application -- > Enterprise Application --> <em>application_instance</em> --> Web Module --> <em>Web Module_instance</em></strong> and, on the settings page for an Web module, set the web module classloder mode.</p>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>The <strong>Web module classloader mode</strong> Specifies whether the classloader should search in the parent classloader or in the application classloader first to load a class. The standard for JDK classloaders and WebSphere classloaders is PARENT_FIRST. By specifying PARENT_LAST, your application can override classes contained in the parent classloader, but this action can potentially result in ClassCastException or LinkageErrors if you have mixed use of overriden classes and non-overriden classes.</p>
|
||
|
|
||
|
<p>The options are PARENT_FIRST and PARENT_LAST. The default is to search in the parent classloader before searching in the application classloader to load a class.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
</body>
|
||
|
</html>
|