back to all blogsSee all blog posts

Expanded InstantOn support and new options to configure the web module class loader in 24.0.0.11-beta

image of author
David Mueller on Oct 22, 2024
Post available in languages:

The 24.0.0.11-beta release expands the collection of InstantOn-supported Liberty features and adds a configuration option for the web module class loader.

The Open Liberty 24.0.0.11-beta includes the following beta features (along with all GA features):

Use Liberty InstantOn with authorization and messaging features

Configure the web module class loader for an enterprise application

Web modules (WARs) that are part of an enterprise application (EAR) can specify their own Class-Path. By default, Liberty adds the JARs that are referenced by a web module Class-Path attribute 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 enable smooth migration from such runtimes to Liberty, the 24.0.0.11-beta release introduces the webModuleClassPathLoader configuration attribute for the enterpriseApplication element, which controls what 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. The war value configures the web module Class-Path to be loaded by the web module class loader. You can set the webModuleClassPathLoader attribute value to ear to configure the enterprise application class loader to load the web module Class-Path.

For example, to configure the EAR named myApp.ear to use the ear class loader, set the following Liberty configuration in the server.xml file:

<enterpriseApplication location="myApp.ear" webModuleClassPathLoader="ear"/>

Try it now

To try out these enhancements, update your build tools to pull the Open Liberty All Beta Features package instead of the main release. The beta works with Java SE 23, 21, 17, 11, and 8.

If you’re using Maven, you can install the All Beta Features package using:

<plugin>
    <groupId>io.openliberty.tools</groupId>
    <artifactId>liberty-maven-plugin</artifactId>
    <version>3.11.1</version>
    <configuration>
        <runtimeArtifact>
          <groupId>io.openliberty.beta</groupId>
          <artifactId>openliberty-runtime</artifactId>
          <version>24.0.0.11-beta</version>
          <type>zip</type>
        </runtimeArtifact>
    </configuration>
</plugin>

You must also add dependencies to your pom.xml file for the beta version of the APIs that are associated with the beta features that you want to try. For example, the following block adds dependencies for two example beta APIs:

<dependency>
    <groupId>org.example.spec</groupId>
    <artifactId>exampleApi</artifactId>
    <version>7.0</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>example.platform</groupId>
    <artifactId>example.example-api</artifactId>
    <version>11.0.0</version>
    <scope>provided</scope>
</dependency>

Or for Gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'io.openliberty.tools:liberty-gradle-plugin:3.9.1'
    }
}
apply plugin: 'liberty'
dependencies {
    libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '[24.0.0.11-beta,)'
}

Or if you’re using container images:

FROM icr.io/appcafe/open-liberty:beta

Or take a look at our Downloads page.

If you’re using IntelliJ IDEA, Visual Studio Code or Eclipse IDE, you can also take advantage of our open source Liberty developer tools to enable effective development, testing, debugging, and application management all from within your IDE.

For more information on using a beta release, refer to the Installing Open Liberty beta releases documentation.

We welcome your feedback

Let us know what you think on our mailing list. If you hit a problem, post a question on StackOverflow. If you find a bug, you can raise an issue.