Hibernate-validator and GraalVM

Hello,

I try to used a graalvm native-image to run my application but i have an exception on hibernate-validator. (see below)

Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.validator.internal.util.logging.Log (implementation not found in java.lang.ClassLoader@4148258)
at org.jboss.logging.Logger$1.run(Logger.java:2556)
at java.security.AccessController.doPrivileged(AccessController.java:80)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516)
at org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:22)
at org.hibernate.validator.internal.util.Version.(Version.java:20)
at com.oracle.svm.core.hub.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:350)
at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:270)

It’s the CloudEvent library that use hibernate-validator.

My stack is:
GraalVM 19.3.-java11
Micronaut 1.2.7
CloudEvent SDK 1.1.0

My Docker File
FROM oracle/graalvm-ce:19.3.0-java11 as graalvm
COPY . /home/app/graalvm-event-service
WORKDIR /home/app/graalvm-event-service
RUN gu install native-image
RUN yum install -y libstdc+±static
RUN native-image --no-server --static
–initialize-at-build-time=com.sun.el.ExpressionFactoryImpl,io.netty.handler.ssl.JettyAlpnSslEngine
-cp target/graalvm-event-service-*.jar

FROM frolvlad/alpine-glibc

EXPOSE 8080
COPY --from=graalvm /home/app/graalvm-event-service .
ENTRYPOINT ["./graalvm-event-service"]

Thanks for your help
Guillaume

My guess is that the generated Logging class has been dead code eliminated by GraalVM so some reflection registration might be needed.

I know we deal with that automatically in Quarkus as JBoss Logging is our logging layer of choice. I don’t know Micronaut though.