1

First up; the code works. I'm getting an exception in my log but no actual error actually occurs. The correct output gets sent to the client, the app keeps running, as far as I can tell everything is fine. Yet I have an error.

I'm using Quarkus and JOOQ. There is an endpoint that triggers a select().fetchInto(Custom.class). The endpoint still returns the correct data. But the log shows this error:

2021-07-02 12:58:25,938 SEVERE [com.sun.xml.bin.v2.run.ref.opt.Injector] (executor-thread-1) null: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:558)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.<clinit>(Injector.java:166)
        at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:51)

The exception is long. And goes through a bunch of different pieces of code:

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:99)
...
at javax.xml.bind.ContextFinder.find(ContextFinder.java:393)
...
at org.jooq.tools.Convert.<clinit>(Convert.java:223)
...
at org.jooq.impl.SelectImpl.fetchInto(SelectImpl.java:3936)
...
at my-code-here-somewhere

Right now I'm running as a simple uber-jar. Native compilation worked fine a while ago but I haven't tested if this error persists in the native binary.

I'd like the error to not be there. I'm fine with a solution to suppress it but if possible I'd like to know who is failing to do something here and if there is a real problem.

Some versions and stuff:

  • Installed Java: 16
  • Targeted Java: 11
  • Quarkus: 1.13.7.Final
  • io.quarkiverse.jooq:quarkus-jooq : 0.2.0
jurgen
  • 325
  • 1
  • 11
  • Have you reported this to https://github.com/quarkiverse/quarkus-jooq as well? – Lukas Eder Jul 02 '21 at 12:24
  • I didn't really know which project to put it under, but per your suggestion I just made one here: https://github.com/quarkiverse/quarkus-jooq/issues/25. – jurgen Jul 02 '21 at 12:30
  • [`sun.misc.Unsafe.defineClass` was removed in JDK 11](https://bugs.openjdk.java.net/browse/JDK-8199699) – Johannes Kuhn Jan 27 '22 at 23:11

1 Answers1

0

When you use jOOQ with Quarkus native (GraalVM) you must register all jOOQ generated classes like POJOs and Records for reflection, so GraalVM does not remove the classes/methods/fields that are not used directly. This is because jOOQ DSL.fetchInto(Class<?>) uses reflection.

You can register the jOOQ generated classes manually or do it automatically with the Gradle task I'm using myself for production software. https://stackoverflow.com/a/70870930/5666188

ThoSap
  • 31
  • 8