quarkus: Opentracing-jdbc does not work with quarkus 2.0.0.CR3

Describe the bug

When using the dependencies

  implementation("io.quarkus:quarkus-smallrye-opentracing")
  implementation("io.opentracing.contrib:opentracing-jdbc")

with the configuration

quarkus:
  datasource:
    db-kind: "postgresql"
    username: "foobar"
    password: "foobar"
    jdbc:
      url: "jdbc:tracing:postgresql://localhost:5432/foobar"
      driver: "io.opentracing.contrib.jdbc.TracingDriver"

I get the following error logs in the console, and the application does not work:

__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
11:46:34.991 WARN  traceId=, parentId=, spanId=, sampled= [io.qu.config] (main) Unrecognized configuration key "quarkus.oidc.credentials.client.secret.value" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
11:46:34.994 INFO  traceId=, parentId=, spanId=, sampled= [or.fl.co.in.li.VersionPrinter] (main) Flyway Community Edition 7.9.1 by Redgate
11:46:35.002 ERROR traceId=, parentId=, spanId=, sampled= [io.qu.ru.Application] (main) Failed to start application (with profile dev): com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface java.sql.Wrapper, interface org.postgresql.PGConnection, interface java.sql.Connection, interface org.postgresql.core.BaseConnection, interface java.lang.AutoCloseable] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
        at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:87)
        at com.oracle.svm.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:113)
        at java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:66)
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1006)
        at io.opentracing.contrib.common.WrapperProxy.wrap(WrapperProxy.java:67)
        at io.opentracing.contrib.jdbc.TracingDriver.connect(TracingDriver.java:176)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:204)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:490)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:472)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:68)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.lang.Thread.run(Thread.java:834)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

It does work in 1.13.7.Final.

Expected behavior

The application should start up and work as expected, no error logs.

Actual behavior

See above logs 😃.

To Reproduce

I don’t have a reproducer yet, maybe you already know what to do? If not, I can provide one. I guess it’s just some class registration missing in graalvm for for the case I do have at hand here, which I think should be done by the dependencies already?

Configuration

quarkus:
  datasource:
    db-kind: "postgresql"
    username: "foobar"
    password: "foobar"
    jdbc:
      url: "jdbc:tracing:postgresql://localhost:5432/foobar"
      driver: "io.opentracing.contrib.jdbc.TracingDriver"

Environment:

Output of uname -a or ver

Linux lena-pc 5.11.0-18-generic #19-Ubuntu SMP Fri May 7 14:22:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version ā€œ11.0.10ā€ 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

Quarkus version or git rev

2.0.0-CR3

Build tool (ie. output of mvnw --version or gradlew --version)


Gradle 7.0

Build time: 2021-04-09 22:27:31 UTC Revision: d5661e3f0e07a8caff705f1badf79fb5df8022c4

Kotlin: 1.4.31 Groovy: 3.0.7 Ant: Apache Antā„¢ version 1.10.9 compiled on September 27 2020 JVM: 11.0.10 (GraalVM Community 11.0.10+8-jvmci-21.0-b06) OS: Linux 5.11.0-18-generic amd64

Additional context

When I remove the dependencies and do not use the tracing, the application does start up and work as expected.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (25 by maintainers)

Most upvoted comments

I provided a PR to downgrade the driver to a working version, see https://github.com/quarkusio/quarkus/pull/18128

I’ll open an issue and write something in the migration guide later this day or tomorrow

I’ve done some tests… to make it work in native mode I had to do all possible permutations of the interfaces for the PostgreSQL classes (PgConnection, PgStatemet, PgPreparedStatement, PgCallableStatement) to build a proxy config for GraalVM… WrapperProxy is using Classes.getAllInterfaces and it does not guarantee the order of the returning classes array… so it ended up being a huge proxy-config.json with all possible permutations (https://gist.github.com/luneo7/453ea0bd0d51a48c6c4377237e8ad831), and the build time was hugely increased…

Using the 0.2.7 version doesn’t help, just because it has a DynamicProxy class that does the same thing as the WrapperProxy… so the same problem happens… The only ā€œnewerā€ version that is not using dynamic proxy is the 0.2.4 version…

If you change the gradle dependency config to:

[...]
    implementation("io.opentracing.contrib:opentracing-jdbc:0.2.4!!") {
        isForce = true
    }
[...]

It will definitely work… so this is a workaround for Quarkus 2.0.0 for now…