Configure the web module class loader for an enterprise application
We can configure web modules (WARs) to use the enterprise application (EAR) class loader instead of the web module class loader, which is used by default. This option can simplify migrating applications to Liberty from an application server that uses the EAR class loader by default, such as WebSphere Application Server traditional.
Web modules (WARs) that are part of an enterprise application (EAR) can specify their own Class-Path. By default, Liberty adds the JARs that a web module Class-Path attribute specifies to the web module class loader. However, some runtime implementations of Java EE and Jakarta EE, such as WebSphere Application Server traditional, instead use the enterprise application class loader for these JARs. Typically, the enterprise application class loader is the parent class loader for the web module class loader.
To simplify migration from WebSphere Application Server traditional to Liberty, we can specify the webModuleClassPathLoader attribute for the enterpriseApplication element. This attribute controls which class loader is used for the JARs that are referenced by a web module Class-Path attribute.
The default value for the webModuleClassPathLoader attribute is war. This value configures the web module class loader to load the web module Class-Path. We can set the webModuleClassPathLoader attribute value to ear to configure the enterprise application class loader to load the web module Class-Path.
Example
For example, to configure the EAR named myApp.ear to use the ear class loader, set the following Liberty configuration in server.xml:<enterpriseApplication location="myApp.ear" webModuleClassPathLoader="ear"/>