Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
260 changes: 260 additions & 0 deletions posts/2025-09-23-25.0.0.10-beta.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
---
layout: post
title: "Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta"
# Do NOT change the categories section
categories: blog
author_picture: https://avatars3.githubusercontent.com/IsmathBadsha
author_github: https://github.com/IsmathBadsha
seo-title: Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta - OpenLiberty.io
seo-description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
blog_description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
open-graph-image: https://openliberty.io/img/twitter_card.jpg
open-graph-image-alt: Open Liberty Logo
---
= Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta
Ismath Badsha <https://github.com/IsmathBadsha>
:imagesdir: /
:url-prefix:
:url-about: /
//Blank line here is necessary before starting the body of the post.

// // // // // // // //
// In the preceding section:
// Do not insert any blank lines between any of the lines.
// Do not remove or edit the variables on the lines beneath the author name.
//
// "open-graph-image" is set to OL logo. Whenever possible update this to a more appropriate/specific image (For example if present an image that is being used in the post). However, it
// can be left empty which will set it to the default
//
// "open-graph-image-alt" is a description of what is in the image (not a caption). When changing "open-graph-image" to
// a custom picture, you must provide a custom string for "open-graph-image-alt".
//
// Replace TITLE with the blog post title eg: MicroProfile 3.3 is now available on Open Liberty 20.0.0.4
// Replace IsmathBadsha with your GitHub username eg: lauracowen
// Replace DESCRIPTION with a short summary (~60 words) of the release (a more succinct version of the first paragraph of the post).
// Replace Ismath Badsha with your name as you'd like it to be displayed,
// eg: LauraCowen
//
// For every link starting with "https://openliberty.io" in the post make sure to use
// {url-prefix}. e.g- link:{url-prefix}/guides/GUIDENAME[GUIDENAME]:
//
// If adding image into the post add :
// -------------------------
// [.img_border_light]
// image::img/blog/FILE_NAME[IMAGE CAPTION ,width=70%,align="center"]
// -------------------------
// "[.img_border_light]" = This adds a faint grey border around the image to make its edges sharper. Use it around screenshots but not
// around diagrams. Then double check how it looks.
// There is also a "[.img_border_dark]" class which tends to work best with screenshots that are taken on dark backgrounds.
// Change "FILE_NAME" to the name of the image file. Also make sure to put the image into the right folder which is: img/blog
// change the "IMAGE CAPTION" to a couple words of what the image is
// // // // // // // //

Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.

// // // // // // // //
// Change the RELEASE_SUMMARY to an introductory paragraph. This sentence is really
// important because it is supposed to grab the readers attention. Make sure to keep the blank lines
//
// Throughout the doc, replace 25.0.0.10-beta with the version number of Open Liberty, eg: 22.0.0.2-beta
// // // // // // // //

The link:{url-about}[Open Liberty] 25.0.0.10-beta includes the following beta features (along with link:{url-prefix}/docs/latest/reference/feature/feature-overview.html[all GA features]):

* <<overrideLibrary, overrideLibrary support for application classloader>>
* <<beta_support_java25, Beta support for Java 25>>

// // // // // // // //
// In the preceding section:
// Change SUB_FEATURE_TITLE to the feature that is included in this release and
// change the SUB_TAG_1/2/3 to the heading tags
//
// However if there's only 1 new feature, delete the previous section and change it to the following sentence:
// "The link:{url-about}[Open Liberty] 25.0.0.10-beta includes SUB_FEATURE_TITLE"
// // // // // // // //

See also link:{url-prefix}/blog/?search=beta&key=tag[previous Open Liberty beta blog posts].

// // // // DO NOT MODIFY THIS COMMENT BLOCK <GHA-BLOG-TOPIC> // // // //
// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/32778
// Contact/Reviewer: tjwatson
// // // // // // // //
[#overrideLibrary]
== overrideLibrary support for application classloader

The 25.0.0.10-beta release introduces a new type of library reference for configuring an application's <classloader/>. This new reference type is called an override library reference. An override library reference works similarly to a private library reference, where class instances remain unique to the application's classloader. However, the key difference is in the search order, the override library class path is searched before the application’s own class path.This allows the library path to override classes that are already contained within the application.

For example, when a `<webApplication/>` contains a class like `org.acme.needs.fix.SomeImpl` that needs to be overridden in order to fix an issue, but rebuilding the application to include the fix is difficult or undesirable,as a new library JAR (e.g., someImplFix.jar) is built to include the corrected class files. Then the following `server.xml` could be used to configure an `overrideLibraryRef` to fix the application without requiring the application to be rebuilt:

[source, xml]
----
<webApplication location="appThatNeedsFix.war">
<classloader overrideLibraryRef="someImplFix"/>
</webApplication>

<library id="someImplFix">
<path name="someImplFix.jar"/>
</library>
----


// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>

// // // // DO NOT MODIFY THIS COMMENT BLOCK <GHA-BLOG-TOPIC> // // // //
// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/32681
// Contact/Reviewer: gjwatts
// // // // // // // //
[#beta_support_java25]
== Beta support for Java 25

Java 25 is the latest version of Java and a Long-Term-Support (LTS) release. It contains many new features and enhancements over previous versions of Java that you will want to review.

There are 18 new features (JEPs) in link:https://openjdk.org/projects/jdk/25/[Java 25]. Six are test features and twelve are fully delivered:

Test features:

* 470: link:https://openjdk.org/jeps/470[PEM Encodings of Cryptographic Objects (Preview)]
* 502: link:https://openjdk.org/jeps/502[Stable Values (Preview)]
* 505: link:https://openjdk.org/jeps/505[Structured Concurrency (Fifth Preview)]
* 507: link:https://openjdk.org/jeps/507[Primitive Types in Patterns, instanceof, and switch (Third Preview)]
* 508: link:https://openjdk.org/jeps/508[Vector API (Tenth Incubator)]
* 509: link:https://openjdk.org/jeps/509[JFR CPU-Time Profiling (Experimental)]

Delivered features:

* 503: link:https://openjdk.org/jeps/503[Remove the 32-bit x86 Port]
* 506: link:https://openjdk.org/jeps/506[Scoped Values]
* 510: link:https://openjdk.org/jeps/510[Key Derivation Function API]
* 511: link:https://openjdk.org/jeps/511[Module Import Declarations]
* 512: link:https://openjdk.org/jeps/512[Compact Source Files and Instance Main Methods]
* 513: link:https://openjdk.org/jeps/513[Flexible Constructor Bodies]
* 514: link:https://openjdk.org/jeps/514[Ahead-of-Time Command-Line Ergonomics]
* 515: link:https://openjdk.org/jeps/515[Ahead-of-Time Method Profiling]
* 518: link:https://openjdk.org/jeps/518[JFR Cooperative Sampling]
* 519: link:https://openjdk.org/jeps/519[Compact Object Headers]
* 520: link:https://openjdk.org/jeps/520[JFR Method Timing & Tracing]
* 521: link:https://openjdk.org/jeps/521[Generational Shenandoah]

An important note about using the `CompletableFuture` and `SubmissionPublisher` classes provided in the Java 25 JDK. If you do not have an explicit Executor backing them, the default is to use the `ForkJoinPool.commonPool`.The pool defaults to a parallelism value equal to the number of available processors minus 1 (# available processors - 1). If your application runs in an environment where you have 2 (or fewer) processors, you could run into issues with concurrency in Java 25 since you will only have 1 thread available by default. This was not an issue in earlier versions of Java as the JDK would overlook the parallelism value and create an additional thread.
To avoid this, you can:
1. Use the `CompletableFuture` provided in Liberty's Jakarta Concurrency implementation, which does not have this issue. An easy way to do that is with a link:https://www.ibm.com/docs/en/was-liberty/core?topic=manually-configuring-managed-executors[DefaultManagedExecutorService] and using link:https://jakarta.ee/specifications/concurrency/3.1/apidocs/jakarta.concurrency/jakarta/enterprise/concurrent/managedexecutorservice#supplyAsync(java.util.function.Supplier[supplyAsync or runAsync]).
2. Explicitly set the `ForkJoinPool.commonPool` parallelism value to whatever you need, `-Djava.util.concurrent.ForkJoinPool.common.parallelism=N` (where N is the minimum number of threads needed)
3. Use an explicit backing Executor

For more information about this change, please reference the following links:
https://bugs.openjdk.org/browse/JDK-8362881
https://bugs.openjdk.org/browse/JDK-8319447
https://bugs.openjdk.org/browse/JDK-8360593


Since Java 25 is a milestone release of Java, we thought you might like to try it out a little early. So take advantage of trying out the new changes now and get more time to preview your applications and microservices running with Java 25.

Just link:https://jdk.java.net/25/[download the latest release of Java 25], download and install the link:https://openliberty.io/downloads/#runtime_betas[25.0.0.10-beta] version of Open Liberty, edit your Liberty server's link:https://openliberty.io/docs/latest/reference/config/server-configuration-overview.html#server-env[server.env] file with JAVA_HOME set to your Java 25 installation directory and start testing!

For more information on Java 25, please visit the Java 25 link:https://jdk.java.net/25/release-notes[release notes page], link:https://download.java.net/java/early_access/jdk25/docs/api/[API Javadoc page] or link:https://jdk.java.net/25/[download page].
For more information on Open Liberty, please visit our link:https://openliberty.io/docs[documentation page].


// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>



To enable the new beta features in your app, add them to your `server.xml`:

[source, xml]
----

----

[#run]
=== Try it now

To try out these features, update your build tools to pull the Open Liberty All Beta Features package instead of the main release. The beta works with Java SE 21, Java SE 17, Java SE 11, and Java SE 8.
// // // // // // // //
// In the preceding section:
// Check if a new non-LTS Java SE version is supported that needs to be added to the list (21, 17, 11, and 8 are LTS and will remain for a while)
// https://openliberty.io/docs/latest/java-se.html
//
// In the following section:
// Check if a new MicroProfile or Jakarta version is in beta that could replace the example values in the codeblock
// // // // // // // //

If you're using link:{url-prefix}/guides/maven-intro.html[Maven], you can install the All Beta Features package using:

[source,xml]
----
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.11.5</version>
<configuration>
<runtimeArtifact>
<groupId>io.openliberty.beta</groupId>
<artifactId>openliberty-runtime</artifactId>
<version>25.0.0.10-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:

[source,xml]
----
<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 link:{url-prefix}/guides/gradle-intro.html[Gradle]:

[source,gradle]
----
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.9.5'
}
}
apply plugin: 'liberty'
dependencies {
libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '[25.0.0.10-beta,)'
}
----
// // // // // // // //
// In the preceding section:
// Replace the Maven `3.8.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-maven-plugin
// Replace the Gradle `3.6.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-gradle-plugin
// TODO: Update GHA to automatically do the above. If the maven.org is problematic, then could fallback to using the GH Releases for the plugins
// // // // // // // //

Or if you're using link:{url-prefix}/docs/latest/container-images.html[container images]:

[source]
----
FROM icr.io/appcafe/open-liberty:beta
----

Or take a look at our link:{url-prefix}/downloads/#runtime_betas[Downloads page].

If you're using link:https://plugins.jetbrains.com/plugin/14856-liberty-tools[IntelliJ IDEA], link:https://marketplace.visualstudio.com/items?itemName=Open-Liberty.liberty-dev-vscode-ext[Visual Studio Code] or link:https://marketplace.eclipse.org/content/liberty-tools[Eclipse IDE], you can also take advantage of our open source link:https://openliberty.io/docs/latest/develop-liberty-tools.html[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 link:{url-prefix}docs/latest/installing-open-liberty-betas.html[Installing Open Liberty beta releases] documentation.

[#feedback]
== We welcome your feedback

Let us know what you think on link:https://groups.io/g/openliberty[our mailing list]. If you hit a problem, link:https://stackoverflow.com/questions/tagged/open-liberty[post a question on StackOverflow]. If you hit a bug, link:https://github.com/OpenLiberty/open-liberty/issues[please raise an issue].