Running Quarkus in native Mode fails: Image Generation failed. Does Quarkus native Mode support Jooq Generation

1.3k Views Asked by At

Running ./mvnw package -Dnative followed by this error:

[ERROR]     [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]     at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:397)
[ERROR]     at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:238)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]     at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:501)

I've already ran another Quarkus project successfully in native mode without Jooq generation. I am very sure the problem is caused by Jooq. We are using the Jooq plugin in our pom.xml in such way:

<plugin>
               <groupId>org.jooq</groupId>
               <artifactId>jooq-codegen-maven</artifactId>
               <version>3.16.4</version>
               <executions>
                   <execution>
                       <id>jooq-codegen-exec1</id>
                       <phase>generate-sources</phase>
                       <goals>
                           <goal>generate</goal>
                       </goals>
                       <configuration>
                           <jdbc>
                               <driver>org.mariadb.jdbc.Driver</driver>
                               <url>jdbc:mariadb://127.0.0.1:3306</url>
                               <user>admin</user>
                               <password>admin</password>
                           </jdbc>
                           <generator>
                               <database>
                                   <includes>.*</includes>
                                   <inputSchema>hvb3</inputSchema>
                               </database>
                               <target>
                                   <packageName>hvbJooq</packageName>
                                   <directory>src/main/java</directory>
                               </target>
                           </generator>
                       </configuration>
                   </execution>
               </executions>
               <dependencies>
                   <dependency>
                       <groupId>mysql</groupId>
                       <artifactId>mysql-connector-java</artifactId>
                       <version>8.0.27</version>
                   </dependency>
                   <dependency>
                       <groupId>org.mariadb.jdbc</groupId>
                       <artifactId>mariadb-java-client</artifactId>
                       <version>3.0.3</version>
                   </dependency>
               </dependencies>
           </plugin>  

Does anybody know anything about this issue?

1

There are 1 best solutions below

0
On

I'm using jOOQ Pro Java 17 with Quarkus & GraalVM native mode for more than half a year in production, but personally I'm not using the Quarkiverse jOOQ extension as it is outdated and is rather difficult to work with jOOQ Express/Pro/Enterprise. I'd like to keeps things up-to-date, my latest prod build is running with Quarkus 2.9.2.Final, jOOQ Pro 3.16.6 Java 17 and GraalVM 22.1.0 Java 17.

For building the microservices last year I switched from Maven to Gradle and luckily I did so, so I could write the following Gradle task that automatically registers all jOOQ generated POJOs, Records and Routines for GraalVM reflection before the GraalVM build is started.

quarkus native reflection configuration for whole package

I hope this helps.