Configuring the web module class loader for an enterprise application
You 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.
About this task
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, you 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. You can set the webModuleClassPathLoader attribute
value to ear to configure the enterprise application class loader to load the web
module Class-Path.
Example
myApp.ear to use the
ear class loader, set the following Liberty configuration in the
server.xml
file:<enterpriseApplication location="myApp.ear" webModuleClassPathLoader="ear"/>