Setting class loader policy to an enterprise application targeted for a WAS

Using the WebSphere® Application Server Deployment editor, you can define the class loader policy for a specific application targeting a remote or local WAS.

Prerequisites

  1. Create an enterprise application and target the server to a WAS v6.0, or later.

To set class loader policy for an application on a WAS, complete the following steps:

  1. Switch to the Java™ EE perspective.

  2. The location of the WAS Deployment editor depends on the specification-level of your enterprise application project:

    • If your enterprise application (EAR) project is at 1.2, 1.3 or 1.4 specification-level, complete the following steps:

      1. In the Enterprise Explorer view, expand your enterprise application project folder.

      2. Under the enterprise application project folder for which you want add or edit server configurations, double-click the

        Deployment Descriptor to open the Application Deployment Descriptor editor.

      3. Select the

        Deployment tab at the bottom of the editor.

      Restriction: Before adding or removing J2EE modules, using the

      Module page in the Application Deployment Descriptor editor, first click the

      Deployment tab to activate the functions in the deployment page. Then add or remove your modules from the Module page. You need to complete this task for each Application Deployment Descriptor editor session that you want to add or remove modules from the Module page.

    • If your enterprise application (EAR) project is at 5.0 specification-level, complete the following steps:

      1. In the Enterprise Explorer view, right-click your enterprise application project folder.

      2. Select

        Java EE | Open WAS Deployment.

  3. Expand the Application section.

  4. In the Applications list box, select the application to modify the class loader settings.

  5. In the

    Classloader mode field, select the class loading mode for the application:

    • PARENT_FIRST causes the class loader to delegate the loading of classes to its parent class loader before attempting to load the class from its local class path.

    • PARENT_LAST causes the class loader to attempt to load classes from its local class path before delegating the class loading to its parent.

  6. In the

    WAR classloader policy field, select the isolation level of Web modules.

    • If this policy is set to

      APPLICATION, then the Web project contents also are loaded by the application class loader (in addition to the EJB files, RAR files, dependency JAR files, and shared libraries).

    • If the policy is set to

      MODULE, then each Web project receives its own class loader whose parent is the application class loader.

  7. In the

    Start weight field, specify the order in which projects in an J2EE application are started. Lower weighted projects are started before higher weighted projects.

  8. Save your changes and close the editor. The class loader policy settings have been added to the deployment descriptor files.