Skip to content

Commit cf008c7

Browse files
authored
Merge pull request #4528 from OpenLiberty/25.0.0.10-beta-post
25.0.0.10-beta draft
2 parents cf5ffca + 91b5ccf commit cf008c7

File tree

1 file changed

+260
-0
lines changed

1 file changed

+260
-0
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
---
2+
layout: post
3+
title: "Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta"
4+
# Do NOT change the categories section
5+
categories: blog
6+
author_picture: https://avatars3.githubusercontent.com/IsmathBadsha
7+
author_github: https://github.com/IsmathBadsha
8+
seo-title: Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta - OpenLiberty.io
9+
seo-description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
10+
blog_description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
11+
open-graph-image: https://openliberty.io/img/twitter_card.jpg
12+
open-graph-image-alt: Open Liberty Logo
13+
---
14+
= Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta
15+
Ismath Badsha <https://github.com/IsmathBadsha>
16+
:imagesdir: /
17+
:url-prefix:
18+
:url-about: /
19+
//Blank line here is necessary before starting the body of the post.
20+
21+
// // // // // // // //
22+
// In the preceding section:
23+
// Do not insert any blank lines between any of the lines.
24+
// Do not remove or edit the variables on the lines beneath the author name.
25+
//
26+
// "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
27+
// can be left empty which will set it to the default
28+
//
29+
// "open-graph-image-alt" is a description of what is in the image (not a caption). When changing "open-graph-image" to
30+
// a custom picture, you must provide a custom string for "open-graph-image-alt".
31+
//
32+
// Replace TITLE with the blog post title eg: MicroProfile 3.3 is now available on Open Liberty 20.0.0.4
33+
// Replace IsmathBadsha with your GitHub username eg: lauracowen
34+
// Replace DESCRIPTION with a short summary (~60 words) of the release (a more succinct version of the first paragraph of the post).
35+
// Replace Ismath Badsha with your name as you'd like it to be displayed,
36+
// eg: LauraCowen
37+
//
38+
// For every link starting with "https://openliberty.io" in the post make sure to use
39+
// {url-prefix}. e.g- link:{url-prefix}/guides/GUIDENAME[GUIDENAME]:
40+
//
41+
// If adding image into the post add :
42+
// -------------------------
43+
// [.img_border_light]
44+
// image::img/blog/FILE_NAME[IMAGE CAPTION ,width=70%,align="center"]
45+
// -------------------------
46+
// "[.img_border_light]" = This adds a faint grey border around the image to make its edges sharper. Use it around screenshots but not
47+
// around diagrams. Then double check how it looks.
48+
// There is also a "[.img_border_dark]" class which tends to work best with screenshots that are taken on dark backgrounds.
49+
// 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
50+
// change the "IMAGE CAPTION" to a couple words of what the image is
51+
// // // // // // // //
52+
53+
Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
54+
55+
// // // // // // // //
56+
// Change the RELEASE_SUMMARY to an introductory paragraph. This sentence is really
57+
// important because it is supposed to grab the readers attention. Make sure to keep the blank lines
58+
//
59+
// Throughout the doc, replace 25.0.0.10-beta with the version number of Open Liberty, eg: 22.0.0.2-beta
60+
// // // // // // // //
61+
62+
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]):
63+
64+
* <<overrideLibrary, overrideLibrary support for application classloader>>
65+
* <<beta_support_java25, Beta support for Java 25>>
66+
67+
// // // // // // // //
68+
// In the preceding section:
69+
// Change SUB_FEATURE_TITLE to the feature that is included in this release and
70+
// change the SUB_TAG_1/2/3 to the heading tags
71+
//
72+
// However if there's only 1 new feature, delete the previous section and change it to the following sentence:
73+
// "The link:{url-about}[Open Liberty] 25.0.0.10-beta includes SUB_FEATURE_TITLE"
74+
// // // // // // // //
75+
76+
See also link:{url-prefix}/blog/?search=beta&key=tag[previous Open Liberty beta blog posts].
77+
78+
// // // // DO NOT MODIFY THIS COMMENT BLOCK <GHA-BLOG-TOPIC> // // // //
79+
// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/32778
80+
// Contact/Reviewer: tjwatson
81+
// // // // // // // //
82+
[#overrideLibrary]
83+
== overrideLibrary support for application classloader
84+
85+
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.
86+
87+
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:
88+
89+
[source, xml]
90+
----
91+
<webApplication location="appThatNeedsFix.war">
92+
<classloader overrideLibraryRef="someImplFix"/>
93+
</webApplication>
94+
95+
<library id="someImplFix">
96+
<path name="someImplFix.jar"/>
97+
</library>
98+
----
99+
100+
101+
// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>
102+
103+
// // // // DO NOT MODIFY THIS COMMENT BLOCK <GHA-BLOG-TOPIC> // // // //
104+
// Blog issue: https://github.com/OpenLiberty/open-liberty/issues/32681
105+
// Contact/Reviewer: gjwatts
106+
// // // // // // // //
107+
[#beta_support_java25]
108+
== Beta support for Java 25
109+
110+
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.
111+
112+
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:
113+
114+
Test features:
115+
116+
* 470: link:https://openjdk.org/jeps/470[PEM Encodings of Cryptographic Objects (Preview)]
117+
* 502: link:https://openjdk.org/jeps/502[Stable Values (Preview)]
118+
* 505: link:https://openjdk.org/jeps/505[Structured Concurrency (Fifth Preview)]
119+
* 507: link:https://openjdk.org/jeps/507[Primitive Types in Patterns, instanceof, and switch (Third Preview)]
120+
* 508: link:https://openjdk.org/jeps/508[Vector API (Tenth Incubator)]
121+
* 509: link:https://openjdk.org/jeps/509[JFR CPU-Time Profiling (Experimental)]
122+
123+
Delivered features:
124+
125+
* 503: link:https://openjdk.org/jeps/503[Remove the 32-bit x86 Port]
126+
* 506: link:https://openjdk.org/jeps/506[Scoped Values]
127+
* 510: link:https://openjdk.org/jeps/510[Key Derivation Function API]
128+
* 511: link:https://openjdk.org/jeps/511[Module Import Declarations]
129+
* 512: link:https://openjdk.org/jeps/512[Compact Source Files and Instance Main Methods]
130+
* 513: link:https://openjdk.org/jeps/513[Flexible Constructor Bodies]
131+
* 514: link:https://openjdk.org/jeps/514[Ahead-of-Time Command-Line Ergonomics]
132+
* 515: link:https://openjdk.org/jeps/515[Ahead-of-Time Method Profiling]
133+
* 518: link:https://openjdk.org/jeps/518[JFR Cooperative Sampling]
134+
* 519: link:https://openjdk.org/jeps/519[Compact Object Headers]
135+
* 520: link:https://openjdk.org/jeps/520[JFR Method Timing & Tracing]
136+
* 521: link:https://openjdk.org/jeps/521[Generational Shenandoah]
137+
138+
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.
139+
To avoid this, you can:
140+
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]).
141+
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)
142+
3. Use an explicit backing Executor
143+
144+
For more information about this change, please reference the following links:
145+
https://bugs.openjdk.org/browse/JDK-8362881
146+
https://bugs.openjdk.org/browse/JDK-8319447
147+
https://bugs.openjdk.org/browse/JDK-8360593
148+
149+
150+
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.
151+
152+
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!
153+
154+
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].
155+
For more information on Open Liberty, please visit our link:https://openliberty.io/docs[documentation page].
156+
157+
158+
// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>
159+
160+
161+
162+
To enable the new beta features in your app, add them to your `server.xml`:
163+
164+
[source, xml]
165+
----
166+
167+
----
168+
169+
[#run]
170+
=== Try it now
171+
172+
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.
173+
// // // // // // // //
174+
// In the preceding section:
175+
// 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)
176+
// https://openliberty.io/docs/latest/java-se.html
177+
//
178+
// In the following section:
179+
// Check if a new MicroProfile or Jakarta version is in beta that could replace the example values in the codeblock
180+
// // // // // // // //
181+
182+
If you're using link:{url-prefix}/guides/maven-intro.html[Maven], you can install the All Beta Features package using:
183+
184+
[source,xml]
185+
----
186+
<plugin>
187+
<groupId>io.openliberty.tools</groupId>
188+
<artifactId>liberty-maven-plugin</artifactId>
189+
<version>3.11.5</version>
190+
<configuration>
191+
<runtimeArtifact>
192+
<groupId>io.openliberty.beta</groupId>
193+
<artifactId>openliberty-runtime</artifactId>
194+
<version>25.0.0.10-beta</version>
195+
<type>zip</type>
196+
</runtimeArtifact>
197+
</configuration>
198+
</plugin>
199+
----
200+
201+
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:
202+
203+
[source,xml]
204+
----
205+
<dependency>
206+
<groupId>org.example.spec</groupId>
207+
<artifactId>exampleApi</artifactId>
208+
<version>7.0</version>
209+
<type>pom</type>
210+
<scope>provided</scope>
211+
</dependency>
212+
<dependency>
213+
<groupId>example.platform</groupId>
214+
<artifactId>example.example-api</artifactId>
215+
<version>11.0.0</version>
216+
<scope>provided</scope>
217+
</dependency>
218+
----
219+
220+
Or for link:{url-prefix}/guides/gradle-intro.html[Gradle]:
221+
222+
[source,gradle]
223+
----
224+
buildscript {
225+
repositories {
226+
mavenCentral()
227+
}
228+
dependencies {
229+
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.9.5'
230+
}
231+
}
232+
apply plugin: 'liberty'
233+
dependencies {
234+
libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '[25.0.0.10-beta,)'
235+
}
236+
----
237+
// // // // // // // //
238+
// In the preceding section:
239+
// Replace the Maven `3.8.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-maven-plugin
240+
// Replace the Gradle `3.6.2` with the latest version of the plugin: https://search.maven.org/artifact/io.openliberty.tools/liberty-gradle-plugin
241+
// 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
242+
// // // // // // // //
243+
244+
Or if you're using link:{url-prefix}/docs/latest/container-images.html[container images]:
245+
246+
[source]
247+
----
248+
FROM icr.io/appcafe/open-liberty:beta
249+
----
250+
251+
Or take a look at our link:{url-prefix}/downloads/#runtime_betas[Downloads page].
252+
253+
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.
254+
255+
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.
256+
257+
[#feedback]
258+
== We welcome your feedback
259+
260+
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].

0 commit comments

Comments
 (0)