Search code examples
javamicronautgraalvmgraalvm-native-image

micronaut - java.lang.IllegalAccessError graalvm native compilation for external dependency


I'm trying to use a custom external library in a micronaut service (aws lambda via api gateway with graalvm native compilation)

I have a few classes in my library that need to be used by jackson during the deserialization. So, I added my classes into the @Introspected annotation in a separate configuration class (as described in documentation https://docs.micronaut.io/latest/guide/index.html#_use_the_code_introspected_code_annotation_on_a_configuration_class)

When I run the native compilation I get an error Error loading a referenced type: java.lang.IllegalAccessError: tried to access class antessio.$Kanye$Introspection from class micronaut.htt.service.$CoreLibBeanInstrospectionConfig$IntrospectionRef0.

To reproduce the issue I created a small project: https://github.com/antessio/micronaut-bean-introspection.

Is there any other configuration or setup that I'm missing?

Note: environment configuration

jdk 1.8

micronaut 1.2.8

graalvm 19.2.1


Solution

  • In the end my issue was related to https://github.com/micronaut-projects/micronaut-core/issues/2596, after upgrading to micronaut 1.2.9 it worked on my example project.