Administer classloaders using the administrative console
There are several classloader policy and classloader mode settings in the administrative console. For more information on these topics, see Classloader policies and Classloader modes.
Set classloaders in application servers
Click Servers --> Application Servers --> server_name and, on the settings page for an application server, set the application classloader policy and application class loading mode. For more information, see Application server settings
.
The Application classloader policy 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 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 classloader to load that application's EJB modules, dependency JAR files, and shared libraries.
The Application classloader mode 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.
Set classloaders in an application
Click Applications --> Enterprise Applications --> application_name and, on the settings page for an application server, set the WAR classloader policy and application classloading mode. For more information, see Enterprise application settings.
The WAR classloader policy 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. The options are APPLICATION and MODULE. The default is to use a separate classloader to load each WAR file (MODULE).
The application classloading mode 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 WAS 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.
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.
Set classloaders in a Web module
Click Enterprise Application --> application_instance --> Web Module --> Web Module_instance and, on the settings page for an Web module, set the web module classloder mode. For more information, see Web Module Deployment settings
.
The Web module classloader mode 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.
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.