Using Java 11.0.9 (GraalVM CE 20.3.0) wth a Micronaut 2.2.1 app making use of Firebase admin 7.1.0, when I package my app as a native image according to the Micronaut documentation, I get the following error:
$ ./gradlew nativeImage
> Task :nativeImage
[application:15026] classlist: 4,054.46 ms, 1.19 GB
[application:15026] (cap): 504.32 ms, 1.19 GB
[application:15026] setup: 1,827.02 ms, 1.19 GB
To see how the classes got initialized, use --trace-class-initialization=org.conscrypt.Conscrypt,org.conscrypt.OpenSSLProvider
[application:15026] analysis: 29,787.52 ms, 3.90 GB
Error: Classes that should be initialized at run time got initialized during image building:
org.conscrypt.Conscrypt was unintentionally initialized at build time. To see why org.conscrypt.Conscrypt got initialized use --trace-class-initialization=org.conscrypt.Conscrypt
org.conscrypt.OpenSSLProvider was unintentionally initialized at build time. To see why org.conscrypt.OpenSSLProvider got initialized use --trace-class-initialization=org.conscrypt.OpenSSLProvider
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
> Task :nativeImage FAILED
FAILURE: Build failed with an exception.
The issue is caused by classes from the package org.conscrypt
. The related dependency is from
com.google.cloud:google-cloud-firestore:1.35.0
that fetches org.conscrypt:conscrypt-openjdk-uber:2.2.1
.
I am really new with GraalVM and far from understanding the cause of such an issue. However, I noticed it should be possible to pass to native-image
some parameters, such as --initialize-at-build-time
.
My question is how to fix this issue? is there a configuration file to create and that Micronaut reads from options to forward to the native-image
executable?