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 order 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 Class loader for each WAR file in application. If the policy is set to Class loader for each WAR file in application, then each web module receives its own class loader whose parent is the application class loader. If the policy is set to Single class loader for application, then the application class loader loads the web module contents as well as the enterprise bean (EJB) modules, shared libraries, resource adapter archive (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. You can set the policy on the Class loading and update detection page of an administrative console.

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

Attention: 如果應用程式在執行中,變更應用程式設定會使應用程式重新啟動。 在獨立式伺服器上,會在儲存變更之後重新啟動應用程式。 在多重伺服器產品上,會在儲存變更之後重新啟動應用程式,在安裝應用程式的節點上,檔案會同步化。 如果要控制多重伺服器產品上的同步化時機,請在「主控台」喜好設定頁面上取消選取與節點同步變更

Procedure

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

    Settings such as Override class reloading settings for web and EJB modules, Polling interval for updated files and WAR class loader policy can affect web module class loading.

    If WAR class loader policy is set to Class loader for each WAR file in application, 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 Single class loader for application, then the application class loader loads the web module contents.

  2. Specify the class loader order 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 order:

    For more information, see the Understanding Class Loaders Redbooks publication, especially the "Changing the WAR class loader delegation mode" step by step instructions.

    Option Description
    載入類別時,先使用母類別載入器 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.
    載入類別時,先使用本端類別載入器 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 載入類別時,先使用本端類別載入器 value, you might receive LinkageErrors or ClassCastException messages if you have mixed use of overridden classes and non-overridden classes.
  3. Click OK.

What to do next

Save the changes to the administrative configuration.


指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:16
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=trun_classload_web
檔名:trun_classload_web.html