I’m encountering a fatal error while trying to build a Quarkus application natively using the mvn clean package -Pnative
command. The build fails when I include the software.amazon.awssdk:servicediscovery
dependency from the AWS SDK. The error indicates that the method java.lang.Object.wait0(long)
is unsupported during the native image build process with GraalVM.
Github Link To the code
Actual Behavior:
The native build fails with the following error:
com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Object.wait0(long) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Error Output:
[1/8] Initializing... (10.1s @ 0.30GB)
Java version: 21.0.3+7-LTS, vendor version: Oracle GraalVM 21.0.3+7.1
Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
C compiler: cl.exe (microsoft, x64, 19.39.33523)
Garbage collector: Serial GC (max heap size: 80% of RAM)
7 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature
- io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
- io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
- io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
- org.eclipse.angus.activation.nativeimage.AngusActivationFeature
- org.hibernate.graalvm.internal.GraalVMStaticFeature: Hibernate ORM's static reflection registrations for GraalVM
------------------------------------------------------------------------------------------------------------------------
4 experimental option(s) unlocked:
- '-H:+AllowFoldMethods' (origin(s): command line)
- '-H:BuildOutputJSONFile' (origin(s): command line)
- '-H:-UseServiceLoaderFeature' (origin(s): command line)
- '-H:+GenerateBuildArtifactsFile' (origin(s): command line)
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 23.91GB of memory (75.6% of 31.64GB system memory, determined at start)
- 20 thread(s) (100.0% of 20 available processor(s), determined at start)
WARNING: A Java agent has been loaded dynamically (D:personalworkspacetempquarkus-with-awstargetquarkus-with-aws-1.0.0-SNAPSHOT-native-image-source-jarlibnet.bytebuddy.byte-buddy-agent-1.14.15.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release
[2/8] Performing analysis... [] (11.2s @ 1.90GB)
12,600 reachable types (79.5% of 15,856 total)
14,654 reachable fields (48.9% of 29,944 total)
55,760 reachable methods (51.1% of 109,030 total)
4,175 types, 133 fields, and 2,918 methods registered for reflection
4 native libraries: crypt32, ncrypt, psapi, winhttp
Fatal error: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.debug.GraalError: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Object.wait0(long) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapObjectArray.readElementValue(ImageHeapObjectArray.java:84)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:464)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.onObjectReachable(SVMImageHeapScanner.java:156)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$markReachable$5(ImageHeapScanner.java:452)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$14(ImageHeapScanner.java:695)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: org.graalvm.compiler.debug.GraalError: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Object.wait0(long) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateImageHeapConstant(ImageHeapScanner.java:212)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateImageHeapConstant(SVMImageHeapScanner.java:109)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapConstant(ImageHeapScanner.java:186)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapObjectArray$3(ImageHeapScanner.java:270)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
... 14 more
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Object.wait0(long) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:268)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:438)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:417)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:78)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:112)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:83)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.createAccessor(ReflectionFeature.java:187)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.getOrCreateAccessor(ReflectionFeature.java:141)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.target.ExecutableAccessorComputer.transform(ExecutableAccessorComputer.java:43)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.computeValue(ComputedValueField.java:366)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.readValue(ComputedValueField.java:336)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readHostedFieldValue(AnalysisConstantReflectionProvider.java:235)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.readHostedFieldValue(SVMImageHeapScanner.java:124)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapInstance(ImageHeapScanner.java:287)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:254)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateImageHeapConstant$2(ImageHeapScanner.java:205)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
Environment:
- Quarkus Version: 3.14.1
- Java Version: 21.0.3 (Oracle GraalVM 21.0.3+7.1)
- GraalVM Version: Oracle GraalVM 21.0.3+7-LTS-jvmci-23.1-b37
- Maven Version: Apache Maven 3.9.8
Does anyone have suggestions on how to resolve this issue or prevent the java.lang.Object.wait0(long)
method from being reachable during the build? I have posted this issue in Quarkus Github