I have built a project with Micronaut framwork and JOOQ library for database connection that runs with GraalVM native-image. It works fine until I make a request which makes a connection to the database that uses JOOQ library.
This is the error that occurs:
14:11:34.486 [default-nioEventLoopGroup-1-3] INFO o.s.j.support.SQLErrorCodesFactory - Default sql-error-codes.xml not found (should be included in spring-jdbc jar)
14:11:34.486 [default-nioEventLoopGroup-1-3] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Could not construct new record
....
Caused by: java.lang.NoSuchMethodException: com.smartbits.configurations.jooq.tables.records.UserConfigurationsRecord.<init>()
at java.lang.Class.getConstructor0(DynamicHub.java:3349)
at java.lang.Class.getDeclaredConstructor(DynamicHub.java:2553)
at org.jooq.impl.Tools.recordFactory(Tools.java:900)
... 171 common frames omitted
I am currently using JOOQ plugin:
nu.studer.jooq version '5.2'
and the dependency:
implementation("io.micronaut.sql:micronaut-jooq")
With GraalVM I have generated the JSON configurations that are needed for the native-image build which are not empty:
jni-config.json, reflect-config.json, resource-config.json
I want to know if there is a way to run JOOQ on a native-image and automatically generate configuration JSON files for JOOQ classes.
I've made some research and I have tried:
- To manually write reflection configurations for JOOQ (just to test it)
- To add
@Introspected
annotation on JOOQ models
As I noticed, the GraalVM doesn't recognize JOOQ classes to create reflection configurations for them.