I'm encountering an issue while trying to build a Spring Boot application using GraalVM and Spring Native. I've removed all the logs from my code, but I'm still facing the following error during the image building process:
Error: Classes that should be initialized at run time got initialized during image building.
I'm using Lombok for logging (@Slf4j), and I suspect that this might be related to the automatic initialization of loggers.
I've tried the following steps without success:
Explicitly initializing loggers in my code. Excluding dependencies from initialization during image building. Checking the Spring Native and GraalVM documentation for any insights. Could someone please guide me on how to resolve this issue? I would greatly appreciate any suggestions or solutions to help me get past this error and successfully build the native image of my Spring Boot application.
Thank you in advance for your help!
[INFO] [creator] Error: Classes that should be initialized at run time got initialized during image building:
[INFO] [creator] ch.qos.logback.classic.Logger was unintentionally initialized at build time. To see why ch.qos.logback.classic.Logger got initialized use --trace-class-initialization=ch.qos.logback.classic.Logger
[INFO] [creator] org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
[INFO] [creator] To see how the classes got initialized, use --trace-class-initialization=ch.qos.logback.classic.Logger,org.slf4j.LoggerFactory
[INFO] [creator] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception