Skip to content

Commit 75e9148

Browse files
committed
Support building Proxy Native via GraalVM CE for JDK 25
1 parent 3af5475 commit 75e9148

21 files changed

Lines changed: 2957 additions & 6324 deletions

File tree

.github/workflows/graalvm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
fail-fast: false
4848
matrix:
4949
os: [ 'ubuntu-latest', 'windows-latest' ]
50-
java-version: [ '24.0.2' ]
50+
java-version: [ '25.0.1' ]
5151
steps:
5252
- uses: actions/checkout@v4
5353
- name: Free Disk Space on Ubuntu
@@ -72,9 +72,9 @@ jobs:
7272
${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-
7373
${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-
7474
# TODO Remove this workaround after. The graalvm native image built with windows server is missing some GRMs for testcontainers
75-
- name: Run test with GraalVM CE
75+
- name: Run test with GraalVM CE for ${{ matrix.java-version }}
7676
if: matrix.os == 'windows-latest'
7777
run: ./mvnw -PgenerateMetadata -e -T 1C clean verify
7878
- name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }}
7979
if: matrix.os == 'ubuntu-latest'
80-
run: ./mvnw -PnativeTestInShardingSphere -e "-DjvmArgs=-XX:MaxRAMPercentage=85.0" clean verify
80+
run: ./mvnw -PnativeTestInShardingSphere -e clean verify

.github/workflows/nightly-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
"PATH=$env:PATH" >> $env:GITHUB_ENV
124124
- uses: graalvm/setup-graalvm@v1
125125
with:
126-
java-version: '24.0.2'
126+
java-version: '25.0.1'
127127
distribution: 'graalvm-community'
128128
github-token: ${{ secrets.GITHUB_TOKEN }}
129129
native-image-job-reports: 'true'
@@ -135,9 +135,9 @@ jobs:
135135
${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-
136136
${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-
137137
# TODO Remove this workaround after. The graalvm native image built with windows server is missing some GRMs for testcontainers
138-
- name: Run test with GraalVM CE
138+
- name: Run test with GraalVM CE for ${{ matrix.java-version }}
139139
if: matrix.os == 'windows-latest'
140140
run: ./mvnw -PgenerateMetadata -e -T 1C clean verify
141-
- name: Run nativeTest with GraalVM CE
141+
- name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }}
142142
if: matrix.os == 'ubuntu-latest'
143-
run: ./mvnw -PnativeTestInShardingSphere -e "-DjvmArgs=-XX:MaxRAMPercentage=85.0" clean verify
143+
run: ./mvnw -PnativeTestInShardingSphere -e clean verify

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
1. Pipeline: Improve "alter transmission rule": verify STREAM_CHANNEL TYPE NAME - [#36864](https://github.com/apache/shardingsphere/pull/36864)
6767
1. Pipeline: InventoryDumperContextSplitter supports multi-columns unique key first integer column splitting - [#36935](https://github.com/apache/shardingsphere/pull/36935)
6868
1. Encrypt: Support handling show create view result decoration in encrypt - [#37299](https://github.com/apache/shardingsphere/pull/37299)
69+
1. Proxy Native: Support building Proxy Native via GraalVM CE for JDK 25 - [#37357](https://github.com/apache/shardingsphere/pull/37357)
6970

7071
### Bug Fixes
7172

distribution/proxy-native/Dockerfile-linux-dynamic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM ghcr.io/graalvm/native-image-community:24.0.2 AS nativebuild
18+
FROM ghcr.io/graalvm/native-image-community:25.0.1 AS nativebuild
1919
WORKDIR /build
2020
COPY ./ .
2121
RUN --mount=type=cache,target=/root/.m2 ./mvnw -am -pl distribution/proxy-native -T1C -DskipTests "-Prelease.native" clean package

distribution/proxy-native/Dockerfile-linux-mostly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM ghcr.io/graalvm/native-image-community:24.0.2 AS nativebuild
18+
FROM ghcr.io/graalvm/native-image-community:25.0.1 AS nativebuild
1919
ENV NATIVE_IMAGE_OPTIONS="--static-nolibc"
2020
WORKDIR /build
2121
COPY ./ .

distribution/proxy-native/Dockerfile-linux-static

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM ghcr.io/graalvm/native-image-community:24.0.2-muslib AS nativebuild
18+
FROM ghcr.io/graalvm/native-image-community:25.0.1-muslib AS nativebuild
1919
ENV NATIVE_IMAGE_OPTIONS="--static,--libc=musl"
2020
WORKDIR /build
2121
COPY ./ .

docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CE 的 `native-image` 命令行工具的长篇大论的 shell 命令。
1515
ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建 GraalVM Native Image。使用者可通过 SDKMAN! 快速切换 JDK。这同理
1616
适用于 https://sdkman.io/jdks#graalhttps://sdkman.io/jdks#nikhttps://sdkman.io/jdks#mandrel`GraalVM CE` 的下游发行版。
1717

18-
- GraalVM CE For JDK 24.0.2,对应于 SDKMAN! 的 `24.0.2-graalce`
18+
- GraalVM CE For JDK 25.0.1,对应于 SDKMAN! 的 `25.0.1-graalce`
1919

2020
用户依然可以使用 SDKMAN! 上的 `21.0.8-graal` 等旧版本的 Oracle GraalVM 来构建 ShardingSphere 的 GraalVM Native Image 产物。
2121
但这将导致集成部分第三方依赖时,构建 GraalVM Native Image 失败。
@@ -52,7 +52,7 @@ java.beans.Introspector was unintentionally initialized at build time. To see wh
5252
<plugin>
5353
<groupId>org.graalvm.buildtools</groupId>
5454
<artifactId>native-maven-plugin</artifactId>
55-
<version>0.11.0</version>
55+
<version>0.11.3</version>
5656
<extensions>true</extensions>
5757
<configuration>
5858
<buildArgs>
@@ -92,12 +92,12 @@ java.beans.Introspector was unintentionally initialized at build time. To see wh
9292

9393
```groovy
9494
plugins {
95-
id 'org.graalvm.buildtools.native' version '0.11.0'
95+
id 'org.graalvm.buildtools.native' version '0.11.3'
9696
}
9797
9898
dependencies {
9999
implementation 'org.apache.shardingsphere:shardingsphere-jdbc:${shardingsphere.version}'
100-
implementation(group: 'org.graalvm.buildtools', name: 'graalvm-reachability-metadata', version: '0.11.0', classifier: 'repository', ext: 'zip')
100+
implementation(group: 'org.graalvm.buildtools', name: 'graalvm-reachability-metadata', version: '0.11.3', classifier: 'repository', ext: 'zip')
101101
}
102102
103103
graalvmNative {

docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ShardingSphere JDBC requires GraalVM Native Image to be built with GraalVM CE as
1616
JDK through `SDKMAN!`. Same reason applicable to downstream distributions of `GraalVM CE` such as https://sdkman.io/jdks#graal ,
1717
https://sdkman.io/jdks#nik and https://sdkman.io/jdks#mandrel .
1818

19-
- GraalVM CE For JDK 24.0.2, corresponding to `24.0.2-graalce` of SDKMAN!
19+
- GraalVM CE For JDK 25.0.1, corresponding to `25.0.1-graalce` of SDKMAN!
2020

2121
Users can still use old versions of Oracle GraalVM such as `21.0.8-graal` on SDKMAN! to build ShardingSphere's GraalVM Native Image product.
2222
But this will cause the failure of building GraalVM Native Image when integrating some third-party dependencies.
@@ -53,7 +53,7 @@ and the documentation of GraalVM Native Build Tools shall prevail.
5353
<plugin>
5454
<groupId>org.graalvm.buildtools</groupId>
5555
<artifactId>native-maven-plugin</artifactId>
56-
<version>0.11.0</version>
56+
<version>0.11.3</version>
5757
<extensions>true</extensions>
5858
<configuration>
5959
<buildArgs>
@@ -95,12 +95,12 @@ Reference https://github.com/graalvm/native-build-tools/issues/572 .
9595

9696
```groovy
9797
plugins {
98-
id 'org.graalvm.buildtools.native' version '0.11.0'
98+
id 'org.graalvm.buildtools.native' version '0.11.3'
9999
}
100100
101101
dependencies {
102102
implementation 'org.apache.shardingsphere:shardingsphere-jdbc:${shardingsphere.version}'
103-
implementation(group: 'org.graalvm.buildtools', name: 'graalvm-reachability-metadata', version: '0.11.0', classifier: 'repository', ext: 'zip')
103+
implementation(group: 'org.graalvm.buildtools', name: 'graalvm-reachability-metadata', version: '0.11.3', classifier: 'repository', ext: 'zip')
104104
}
105105
106106
graalvmNative {

docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.cn.md

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ShardingSphere 定义了,
2525

2626
贡献者必须在设备安装,
2727

28-
1. GraalVM CE 24.0.2,或与 GraalVM CE 24.0.2 兼容的 GraalVM 下游发行版。以 [GraalVM Native Image](/cn/user-manual/shardingsphere-jdbc/graalvm-native-image) 为准。
28+
1. GraalVM CE 25.0.1,或与 GraalVM CE 25.0.1 兼容的 GraalVM 下游发行版。以 [GraalVM Native Image](/cn/user-manual/shardingsphere-jdbc/graalvm-native-image) 为准。
2929
2. 编译 GraalVM Native Image 所需要的本地工具链。以 https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites 为准。
3030
3. 可运行 Linux Containers 的 Docker Engine,或与 testcontainers-java 兼容的 Container Runtime。以 https://java.testcontainers.org/supported_docker_environment/ 为准。
3131

@@ -41,8 +41,8 @@ ShardingSphere 定义了,
4141
sudo apt install unzip zip -y
4242
curl -s "https://get.sdkman.io" | bash
4343
source "$HOME/.sdkman/bin/sdkman-init.sh"
44-
sdk install java 24.0.2-graalce
45-
sdk use java 24.0.2-graalce
44+
sdk install java 25.0.1-graalce
45+
sdk use java 25.0.1-graalce
4646
```
4747

4848
可在 bash 通过如下命令安装编译 GraalVM Native Image 所需要的本地工具链。
@@ -85,11 +85,11 @@ winget install --id version-fox.vfox --source winget --exact
8585
if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'
8686
# 此时需要打开新的 Powershell 7 终端
8787
vfox add java
88-
vfox install java@24.0.2-graalce
89-
vfox use --global java@24.0.2-graalce
88+
vfox install java@25.0.1-graalce
89+
vfox use --global java@25.0.1-graalce
9090
```
9191
92-
当 Windows 弹出窗口,要求允许类似 `C:\users\shard\.version-fox\cache\java\v-24.0.2-graalce\java-24.0.2-graalce\bin\java.exe` 路径的应用通过 Windows 防火墙时,应当批准。
92+
当 Windows 弹出窗口,要求允许类似 `C:\users\shard\.version-fox\cache\java\v-25.0.1-graalce\java-25.0.1-graalce\bin\java.exe` 路径的应用通过 Windows 防火墙时,应当批准。
9393
背景参考 https://support.microsoft.com/en-us/windows/risks-of-allowing-apps-through-windows-firewall-654559af-3f54-3dcf-349f-71ccd90bcc5c 。
9494
9595
可在 Powershell 7 通过如下命令安装编译 GraalVM Native Image 所需要的本地工具链。**特定情况下,开发者可能需要为 Visual Studio 的使用购买许可证。**
@@ -286,34 +286,38 @@ class SolutionTest {
286286
当前执行 `./mvnw -PnativeTestInShardingSphere -e -T 1C clean verify` 将涉及到针对 `com.oracle.svm.core.code.CodeCachePoolMXBean` 的警告日志,
287287
288288
```shell
289-
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access
290-
291-
com.oracle.svm.core.code.CodeCachePoolMXBean$CodeAndDataPool.getConstructors()
292-
293-
without it being registered for runtime reflection. Add com.oracle.svm.core.code.CodeCachePoolMXBean$CodeAndDataPool.getConstructors() to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
294-
java.base@24.0.2/java.lang.Class.getConstructors(DynamicHub.java:1128)
295-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.findConstructors(MBeanIntrospector.java:459)
296-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:430)
297-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:389)
298-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:137)
299-
java.management@24.0.2/com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
300-
java.management@24.0.2/javax.management.StandardMBean.construct(StandardMBean.java:174)
301-
java.management@24.0.2/javax.management.StandardMBean.<init>(StandardMBean.java:268)
302-
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access
303-
304-
com.oracle.svm.core.code.CodeCachePoolMXBean$NativeMetadataPool.getConstructors()
305-
306-
without it being registered for runtime reflection. Add com.oracle.svm.core.code.CodeCachePoolMXBean$NativeMetadataPool.getConstructors() to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
307-
java.base@24.0.2/java.lang.Class.getConstructors(DynamicHub.java:1128)
308-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.findConstructors(MBeanIntrospector.java:459)
309-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:430)
310-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:389)
311-
java.management@24.0.2/com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:137)
312-
java.management@24.0.2/com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
313-
java.management@24.0.2/javax.management.StandardMBean.construct(StandardMBean.java:174)
314-
java.management@24.0.2/javax.management.StandardMBean.<init>(StandardMBean.java:268)
289+
org.graalvm.nativeimage.MissingReflectionRegistrationError: Cannot reflectively access the 'com.oracle.svm.core.code.CodeCachePoolMXBean$CodeAndDataPool'. To allow this operation, add the following to the 'reflection' section of 'reachability-metadata.json' and rebuild the native image:
290+
291+
{
292+
"type": "com.oracle.svm.core.code.CodeCachePoolMXBean$CodeAndDataPool"
293+
}
294+
295+
The 'reachability-metadata.json' file should be located in 'META-INF/native-image/<group-id>/<artifact-id>/' of your project. For further help, see https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection
296+
java.base@25.0.1/java.lang.Class.getConstructors(DynamicHub.java:1277)
297+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.findConstructors(MBeanIntrospector.java:459)
298+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:430)
299+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:389)
300+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:137)
301+
java.management@25.0.1/com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
302+
java.management@25.0.1/javax.management.StandardMBean.construct(StandardMBean.java:174)
303+
java.management@25.0.1/javax.management.StandardMBean.<init>(StandardMBean.java:268)
304+
org.graalvm.nativeimage.MissingReflectionRegistrationError: Cannot reflectively access the 'com.oracle.svm.core.code.CodeCachePoolMXBean$NativeMetadataPool'. To allow this operation, add the following to the 'reflection' section of 'reachability-metadata.json' and rebuild the native image:
305+
306+
{
307+
"type": "com.oracle.svm.core.code.CodeCachePoolMXBean$NativeMetadataPool"
308+
}
309+
310+
The 'reachability-metadata.json' file should be located in 'META-INF/native-image/<group-id>/<artifact-id>/' of your project. For further help, see https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection
311+
java.base@25.0.1/java.lang.Class.getConstructors(DynamicHub.java:1277)
312+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.findConstructors(MBeanIntrospector.java:459)
313+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:430)
314+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:389)
315+
java.management@25.0.1/com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:137)
316+
java.management@25.0.1/com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
317+
java.management@25.0.1/javax.management.StandardMBean.construct(StandardMBean.java:174)
318+
java.management@25.0.1/javax.management.StandardMBean.<init>(StandardMBean.java:268)
315319
```
316320
317-
相关警告在 `GraalVM CE For JDK 24.0.2` 上无法避免。
321+
相关警告在 `GraalVM CE For JDK 25.0.1` 上无法避免。
318322
因为 `com.oracle.svm.core.code.CodeCachePoolMXBean` 的无参构造函数通过 Java 类 `org.graalvm.nativeimage.Platform.HOSTED_ONLY` 被标记为无论实际的 Platform 是什么,
319323
仅在 Native Image 生成期间可见,且无法在 Runtime 使用的元素。

0 commit comments

Comments
 (0)