admin管理员组文章数量:1242791
Very basic app following the instructions at .html
No weird and wonderful dependencies or anything UPDATE pom.xml included
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0" xmlns:xsi=";
xsi:schemaLocation=".0.0 .0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>nativetest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>native</name>
<description>native</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
mvn native:compile fails with Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle()
$ java --version
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment GraalVM 22.3.0 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode, sharing)
Do I need to do something different/not mentioned in the spring tutorial to get the native compilation to work?
Perhaps some mvn or pom changes required?
Can anyone assist with some steps to get the below command to succeed, please?
Is there perhaps a different spring-boot version that works better with graalvm native build? UPDATE: spring-boot-starter-parent version 3.3.8 build succeeds, so issue seems to only affect 3.4.2
$ ./mvnw -Pnative -DskipTests clean native:compile
...
...
...
[1/7] Initializing... (2.3s @ 0.25GB) Version info: 'GraalVM 22.3.0 Java 17 CE' Java version info: '17.0.5+8-LTS' C compiler: gcc (linux, x86_64, 13.3.0) Garbage collector: Serial GC 1 user-specific feature(s) - .springframework.aot.nativex.feature.PreComputeFieldFeature SLF4J(W): No SLF4J providers were found. SLF4J(W): Defaulting to no-operation (NOP) logger implementation SLF4J(W): See .html#noProviders for further details. [2/7] Performing analysis... [********] (13.3s @ 3.34GB) 16,725 (92.41%) of 18,098 classes reachable 27,019 (67.57%) of 39,988 fields reachable 79,131 (62.19%) of 127,242 methods reachable 1,021 classes, 353 fields, and 5,776 methods registered for reflection 64 classes, 70 fields, and 55 methods registered for JNI access 4 native libraries: dl, pthread, rt, z [3/7] Building universe... (2.2s @ 2.44GB) [4/7] Parsing methods... [*] (1.4s @ 3.62GB) [5/7] Inlining methods... [****] (0.9s @ 2.30GB) [6/7] Compiling methods... [***] (9.4s @ 4.24GB) [7/7] Creating image... (0.0s @ 2.08GB) Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle() at .graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:696) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128) Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle() at .graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.getOrCreateAccessor(ReflectionFeature.java:121) at .graalvm.nativeimage.builder/com.oracle.svm.core.reflect.target.ExecutableAccessorComputer.transform(ExecutableAccessorComputer.java:43) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueFieldputeValue(ComputedValueField.java:343) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.readValue(ComputedValueField.java:313) at .graalvm.nativeimage.builder/com.oracle.svm.core.meta.ReadableJavaField.readFieldValue(ReadableJavaField.java:38) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readValue(AnalysisConstantReflectionProvider.java:97) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedField.readValue(HostedField.java:161) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:439) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObject(NativeImageHeap.java:295) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:598) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:198) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:678) ... 4 more ------------------------------------------------------------------------------------------------------------------------ 1.7s (5.0% of total time) in 41 GCs | Peak RSS: 6.73GB | CPU load: 16.70 ========================================================================================================================
Very basic app following the instructions at https://docs.spring.io/spring-boot/how-to/native-image/developing-your-first-application.html
No weird and wonderful dependencies or anything UPDATE pom.xml included
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache./POM/4.0.0" xmlns:xsi="http://www.w3./2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache./POM/4.0.0 https://maven.apache./xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>nativetest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>native</name>
<description>native</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
mvn native:compile fails with Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle()
$ java --version
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment GraalVM 22.3.0 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode, sharing)
Do I need to do something different/not mentioned in the spring tutorial to get the native compilation to work?
Perhaps some mvn or pom changes required?
Can anyone assist with some steps to get the below command to succeed, please?
Is there perhaps a different spring-boot version that works better with graalvm native build? UPDATE: spring-boot-starter-parent version 3.3.8 build succeeds, so issue seems to only affect 3.4.2
$ ./mvnw -Pnative -DskipTests clean native:compile
...
...
...
[1/7] Initializing... (2.3s @ 0.25GB) Version info: 'GraalVM 22.3.0 Java 17 CE' Java version info: '17.0.5+8-LTS' C compiler: gcc (linux, x86_64, 13.3.0) Garbage collector: Serial GC 1 user-specific feature(s) - .springframework.aot.nativex.feature.PreComputeFieldFeature SLF4J(W): No SLF4J providers were found. SLF4J(W): Defaulting to no-operation (NOP) logger implementation SLF4J(W): See https://www.slf4j./codes.html#noProviders for further details. [2/7] Performing analysis... [********] (13.3s @ 3.34GB) 16,725 (92.41%) of 18,098 classes reachable 27,019 (67.57%) of 39,988 fields reachable 79,131 (62.19%) of 127,242 methods reachable 1,021 classes, 353 fields, and 5,776 methods registered for reflection 64 classes, 70 fields, and 55 methods registered for JNI access 4 native libraries: dl, pthread, rt, z [3/7] Building universe... (2.2s @ 2.44GB) [4/7] Parsing methods... [*] (1.4s @ 3.62GB) [5/7] Inlining methods... [****] (0.9s @ 2.30GB) [6/7] Compiling methods... [***] (9.4s @ 4.24GB) [7/7] Creating image... (0.0s @ 2.08GB) Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle() at .graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:696) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128) Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public .springframework.boot.ssl.SslBundle .springframework.boot.http.client.ClientHttpRequestFactorySettings.sslBundle() at .graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.getOrCreateAccessor(ReflectionFeature.java:121) at .graalvm.nativeimage.builder/com.oracle.svm.core.reflect.target.ExecutableAccessorComputer.transform(ExecutableAccessorComputer.java:43) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueFieldputeValue(ComputedValueField.java:343) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.readValue(ComputedValueField.java:313) at .graalvm.nativeimage.builder/com.oracle.svm.core.meta.ReadableJavaField.readFieldValue(ReadableJavaField.java:38) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readValue(AnalysisConstantReflectionProvider.java:97) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedField.readValue(HostedField.java:161) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:439) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObject(NativeImageHeap.java:295) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:598) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:198) at .graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:678) ... 4 more ------------------------------------------------------------------------------------------------------------------------ 1.7s (5.0% of total time) in 41 GCs | Peak RSS: 6.73GB | CPU load: 16.70 ========================================================================================================================Share Improve this question edited yesterday capitalgsw asked 2 days ago capitalgswcapitalgsw 192 bronze badges New contributor capitalgsw is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 8
- Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented 2 days ago
- Clarified ask via edit – capitalgsw Commented yesterday
- It is supposed to work with 3.4.2 - which dependencies are you using? – dan1st Commented yesterday
- @dan1st have updated question with pom extract – capitalgsw Commented yesterday
- I couldn't get the GraalVM distribution for Java v17 because of the license agreement and the requirement for an Oracle account. However, I was able to download v21 (graalvm-jdk-21.0.6+8.1, which is also an LTS version) and the demo project with the POM file you provided. It builds successfully with the command you referenced. Can you check that your local environment versions are supported? ref: docs.spring.io/spring-boot/system-requirements.html – Dmitriy Commented yesterday
1 Answer
Reset to default -1$ java --version openjdk 17.0.14 2025-01-21 LTS OpenJDK Runtime Environment Liberica-NIK-23.0.7-1 (build 17.0.14+10-LTS) OpenJDK 64-Bit Server VM Liberica-NIK-23.0.7-1 (build 17.0.14+10-LTS, mixed mode, sharing)
Using version 23.0.7.r17-nik VM solves this. So tutorial is slightly wrong (it says to use 22.3.r17-nik)
Thanks to @Dmitriy for the assist
本文标签: mavenGraalVM native compilation of Spring Boot 342 fails with VMErrorHostedErrorStack Overflow
版权声明:本文标题:maven - GraalVM native compilation of Spring Boot 3.4.2 fails with VMError$HostedError - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740089835a2223932.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论