-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
"exception" : "java.lang.RuntimeException: com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.\n\
I get the following error. Even if I add the classes that can't be found to the 'buildArgs.add("--initialize-at-build-time=example.com.package")' option, it still doesn't help. The only thing that helped my image to run without errors was to start the trace agent with the option 'experimental-class-define-support' and then save the classes as bytecodes under resources/META-INF/native-image/group/artifact/predefined-classes-config.json. However, it would not be a solution as it is not programmatic. The classes were registered by the trace agent for Reflections, but cannot be found 'to runtime'. All classes not found are parts of the custom library that have been added to the Gradle folder. Could it be that the initialize-at-build-time option has to be used in a different way? For example:
buildArgs.add('initialize-at-build-time=ownlib.jar:example.com.package') ? Is there another way to programmatically define the classes at build-time without having to add the bytecodes of the classes?
I am very happy to receive feedback from you!
This is a Spring Boot project of version 3.0.6
The image was built with the Gradle command: ./gradlew bootBuildImage. Here are my Gradle configurations for the native image:
java version "17.0.7" 2023-04-18 LTS Java(TM) SE Runtime Environment Oracle GraalVM 17.0.7+8.1 (build 17.0.7+8-LTS-jvmci-23.0-b12) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.7+8.1 (build 17.0.7+8-LTS-jvmci-23.0-b12, mixed mode, sharing)
`verbose.set(true)
buildArgs.add("-H:+BuildReport")
buildArgs.add("-H:AddOpens=java.base/java.lang=ALL-UNNAMED")
buildArgs.add("-H:AddOpens=java.base/java.util=ALL-UNNAMED")
buildArgs.add("-H:AddOpens=java.base/java.util.regex=ALL-UNNAMED")
buildArgs.add("-H:AddOpens=java.base/java.util.zip=ALL-UNNAMED")
buildArgs.add("-H:AddOpens=java.base/java.time.format=ALL-UNNAMED")
buildArgs.add("-H:+AllowIncompleteClasspath")
buildArgs.add("-H:-SupportPredefinedClasses")
}