Configure application class loaders

 

Configure application class loaders

You can set values that control the class-loading behavior of an installed enterprise application. Class loaders enable an application to access repositories of available classes and resources.

This article assumes that you have installed
an application on an application server.

Configure the class loaders of an enterprise application to set class-loader policy and mode values for this application.

An application class loader groups enterprise bean (EJB) modules, shared libraries, resource adapter archives (RAR files), and dependency Java archive (JAR) files associated to an application. Dependency JAR files are JAR files that contain code which can be used by both enterprise beans and servlets.

An application class loader is the parent of a Web application archive (WAR) class loader. By default, a Web module has its own WAR class loader to load the contents of the Web module. 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.

Use the administrative console to configure the class loaders.

  1. Click Applications > Enterprise Applications > application_name to access the Enterprise application settings page.

  2. Specify the class-loader mode for the application. The application class-loader mode specifies whether the class loader searches in the parent class loader or in the application class loader first to load a class. The default is to search in the parent class loader before searching in the application class loader to load a class. Select either of the following values for Class loader mode :

    Option Description
    Parent First Causes the class loader to search in the parent class loader first to load a class. This value is the standard for Development Kit class loaders and WebSphere Application Server class loaders.
    Parent Last Causes the class loader to search in the application class loader first to load a class. By specifying Parent Last, your application can override classes contained in the parent class loader.

    Tip: Specifying the Parent Last value might result in LinkageErrors or ClassCastException messages if you have mixed use of overridden classes and non-overridden classes.

  3. Specify whether to use a single or multiple class loaders to load Web application archives (WAR files) of your application. By default,
    Web modules have their own WAR class loader to load the contents of the WEB-INF/classes and WEB-INF/lib directories. The default WAR class loader value is Module, which uses a separate class loader to load each WAR file. Setting the value to Application causes the application class loader to load the Web module contents as well as the EJB modules, shared libraries, RAR files, and dependency JAR files associated to the application. The application class loader is the parent of the WAR class loader. Select either of the following values for WAR class loader policy :

    Option Description
    Module Uses a different class loader for each WAR file.
    Application Uses a single class loader to load all of the WAR files in your application.

  4. Specify whether to enable class reloading when application files are updated. By default, class reloading is not enabled. See the description for Enable class reloading in the Enterprise application settings page for details on enabling and disabling reloading. You might specify different values for EJB modules and for Web modules such as servlets and JavaServer page (JSP) files.

  5. Specify the number of seconds to scan the application's file system for updated files. The value specified for Reloading interval takes effect only if class reloading is enabled. The default is the value of the reloading interval attribute in the IBM extension (META-INF/ibm-application-ext.xmi) file of the enterprise application (EAR file). You might specify different values for EJB modules and for Web modules such as servlets and JSP files.

    To enable reloading, specify an integer value that is greater than zero (for example, 1 to 2147483647).

    To disable reloading, specify zero (0).

  6. Click OK .

 

What to do next

Save the changes to the administrative configuration.


Related concepts
Class loaders

Related tasks
Class loading

Related reference
Enterprise application settings