Graal VM native image: Substitution target for o.s.o.j.v.Target_BytecodeProvider is not loaded #31452
Closed
Description
Environment
Spring Framework: 6.1 RC1
JDK 21 / GraalVM 21
GRAALVM_HOME: /Users/runner/hostedtoolcache/graalvm-jdk-21_macos-x64_bin/21.0.0/x64/graalvm-jdk-21.0.1+12.1/Contents/Home
JAVA_HOME: /Users/runner/hostedtoolcache/graalvm-jdk-21_macos-x64_bin/21.0.0/x64/graalvm-jdk-21.0.1+12.1/Contents/Home
java 21.0.1 20[23](https://github.com/mmoayyed/cas/actions/runs/6553858619/job/17800344875#step:4:24)-10-17
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
native-image 21.0.1 2023-10-17
GraalVM Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
Substrate VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12, serial gc, compressed references)
GitHub Actions: MacOS
Gradle: 8.4
Error
Native image builds produce the following:
com.oracle.svm.core.util.UserError$UserException: Substitution target for org.springframework.orm.jpa.vendor.Target_BytecodeProvider is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
[1/8] �]8;;[https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#stage-initializing�\Initializing�]8;;�\...](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#stage-initializing%1B\Initializing%1B]8;;%1B\...) (0.0s @ 0.51GB)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1074)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:373)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:351)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:1029)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:907)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:590)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
Build logs are here.
Steps to reproduce the issue
git clone --depth 1 git@github.com:mmoayyed/cas.git
./gradlew :webapp:cas-server-webapp-native:build :webapp:cas-server-webapp-native:nativeCompile \
-x check -x test -x javadoc --configure-on-demand --no-configuration-cache \
-DskipNestedConfigMetadataGen=true --no-daemon