Configuring Web module class loaders

You can set values that control the class-loading behavior of an installed Web module.

Before you begin

This topic assumes that you installed a Web module on an application server.

About this task

Configure the class loader mode value of an installed Web module. By default, a Web module has its own Web application archive (WAR) class loader to load the contents of the Web module, which are in the WEB-INF/classes and WEB-INF/lib directories.

An application class loader is the parent of a WAR class loader. The WAR class-loader policy value of an application class loader determines whether the WAR class loader or the application class loader is used to load the contents of the Web module.

The default WAR class loader policy value is Module. If the policy is set to Module, then each Web module receives its own class loader whose parent is the application class loader. If the policy is set to Application on the settings page of an enterprise application, then the application class loader loads the Web module contents as well as the enterprise bean (EJB) modules, shared libraries, resource adapter archives (RAR files), and dependency Java archive (JAR) files associated to an application. Thus, the configuration of the parent application class loader affects the WAR class loader.

Use the administrative console to configure the application and WAR class loaders.

Attention: If an application is running, changing an application setting causes the application to restart. On stand-alone servers, the application restarts after you save the change. On multiple-server products, the application restarts after you save the change and files synchronize on the node where the application is installed.

Procedure

  1. If you have not done so already, configure the application class loader.

    Settings such as WAR class loader policy, Enable class reloading, and Reloading interval can affect Web module class loading.

    If WAR class loader policy is set to Module, then the Web module receives its own class loader and the WAR class-loader policy of the Web module defines the mode for a WAR class loader. If the policy is set to Application, then the application class loader loads the Web module contents.

  2. Click Applications > Enterprise Application > application_name > Web modules > Web_module_name to access the settings page for a deployed Web module.
  3. Specify the class loader mode for the installed Web module.

    The Web module class-loader mode specifies whether the class loader searches in the parent application class loader or in the WAR class loader first to load a class. The default is to search in the parent application class loader before searching in the WAR class loader to load a class.

    Select either of the following values for Class loader mode:

    Option Description
    Parent first This option causes the class loader to prefer classes that are provided by the product over the classes that exist within the Web module. This approach is standard for Development Kit class loaders and WebSphere Application Server class loaders.
    Parent last This option causes the class loader to prefer classes that exist in the Web module over the classes that are provided by the product. If the same class exists in both the product and the Web module, the class from the Web module is loaded.
    Attention: If you specify the Parent last value, you might receive LinkageErrors or ClassCastException messages if you have mixed use of overridden classes and non-overridden classes.
  4. Click OK.

What to do next

Save the changes to the administrative configuration.



In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Aug 29, 2010 10:43:27 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v602web&product=was-nd-mp&topic=trun_classload_web
File name: trun_classload_web.html