Quarkus 2.5.1/Graalvm 21.3.0 CE/Java 17 - native app failure #22018
-
My native app is compiled with Gradle 7.3.1 and has the the following dependencies, amongst them QUARKUS-CACHE: dependencies {
//Quarkus
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-config-yaml'
implementation 'io.quarkus:quarkus-cache'
implementation 'io.quarkus:quarkus-hibernate-validator'
implementation 'io.quarkus:quarkus-smallrye-context-propagation'
implementation 'io.quarkus:quarkus-resteasy-jackson'
} However, when I run the generated native .EXE, I get the below error - WHY?
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
What happens if you add a reflection-config.json (referencing the class in the error message) like the following in your app?https://github.com/quarkusio/registry.quarkus.io/blob/main/src/main/resources/reflection-config.json |
Beta Was this translation helpful? Give feedback.
-
It looks like this class is removed during build time because it is considered unused, if you could provide a small reproducer that would be great |
Beta Was this translation helpful? Give feedback.
-
Yes, so this is a classic error unfortunately. Caffeine is using different classes to handle the cache depending on the configuration you are using. We tried to register all of them for reflection at some point but we ended up with a gazillion of classes and a huge cost in image size. Just add the following to one of your application classes: @RegisterForReflection(targets = { com.github.benmanes.caffeine.cache.PSAMS.class }) and things should work OK. |
Beta Was this translation helpful? Give feedback.
-
@gsmet @gastaldi your suggestion does not work: @RegisterForReflection(targets = { com.github.benmanes.caffeine.cache.PSAMS.class }) I get this compile error:
|
Beta Was this translation helpful? Give feedback.
-
should do the trick. |
Beta Was this translation helpful? Give feedback.
-
@gsmet the annotation with strings worked! Thanks!
|
Beta Was this translation helpful? Give feedback.
@gsmet the annotation with strings worked! Thanks!