I want to load dynamic class in native model,but i get a error.
Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
at java.base@17.0.7/java.lang.ClassLoader.defineClass(ClassLoader.java:288)
at zcsoft.nativex.util.MyClassLoader.findClass(MyClassLoader.java:43)
at zcsoft.nativex.util.MyClassLoader.exportClass(MyClassLoader.java:78)
at zcsoft.nativex.util.UtilApplication.main(UtilApplication.java:18)
How to load dynamic class in native model,I don't know how to generate predefined-classes-config.json. The DynamicLoad.class need copy to /data/classes from demo resource nativex-dynamic.zip
Comment From: wilkinsona
This is a general GraalVM limitation and isn't Spring Boot-specific. You'll have to define the classes at build time and include them in the native image. See https://www.graalvm.org/22.2/reference-manual/native-image/metadata/#predefined-classes for details.