GraalVM Native Image: SLF4J, Logback, Netty, InetAddress & Initialization Errors Despite Proper Configuration #11322
-
I’m encountering an error while building a GraalVM native image for a Spring Boot application in multimode setup. The error indicates that an object of type org.slf4j.helpers.SubstituteLoggerFactory is found in the image heap, but the class is not initialized at build time. Environment:
Dependency Resolution Strategy: eachDependency { details -> --initialize-at-build-time=org.slf4j.helpers.SubstituteLoggerFactory Error: Build resources:
Fatal error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: An object of type 'org.slf4j.helpers.SubstituteLoggerFactory' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default. You now have two options to resolve this:
to the native-image arguments. Note that initializing new types can store additional objects to the heap. It is advised to check the static fields of 'org.slf4j.helpers.SubstituteLoggerFactory' to see if they are safe for build-time initialization, and that they do not contain any sensitive data that should not become part of the image.
What I've Tried
My Questions
Any help or insight would be appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thank you for reaching out to us. There is a newer version of GraalVM which is GraalVM for JDK 24 Community 24.0.1 that you should use which you can find here https://github.com/graalvm/graalvm-ce-builds/releases/ . Please try testing with it and if the issue still persists, could you also please specify which OS version you are encountering this issue on? To address your question, I think if the the issue persists, it could be because there might be another conflicting |
Beta Was this translation helpful? Give feedback.
Hi @vinaykumarpandey,
Thank you for reaching out to us.
There is a newer version of GraalVM which is GraalVM for JDK 24 Community 24.0.1 that you should use which you can find here https://github.com/graalvm/graalvm-ce-builds/releases/ . Please try testing with it and if the issue still persists, could you also please specify which OS version you are encountering this issue on?
To address your question, I think if the the issue persists, it could be because there might be another conflicting
--initialize-at-run-time
flag somewhere in your app that causes this issue. Also using the tracing agent and running all the necessary tests to cover the functionalities of your application should cre…