Skip to content

ClassCastException while accessing query results with Mutiny SQLClient #50788

@fedinskiy

Description

@fedinskiy

Describe the bug

I am using Mutiny SQL client to execute a query on a database and retrieve its results. The code compiles, but throws ClassCastException: class io.vertx.pgclient.impl.RowImpl cannot be cast to class io.vertx.mutiny.sqlclient.Row during runtime.

Expected behavior

The application should not throw ClassCastException during runtime, if there is no casts in user code.

Actual behavior

2025-10-30 15:42:06,165 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /pool failed, error id: 54b3fd8d-e531-4fa8-a784-4dd78abd022d-1

Exception in GreetingResource.java:41
	  39          RowSet<Row> rows = connection.query("SELECT version();").executeAndAwait();
	  40          System.out.println(rows.size());
	→ 41          Row x = rows.stream().findFirst().get();
	  42          System.out.println(x);
	  43          System.out.println(x.getString(1));: java.lang.ClassCastException: class io.vertx.pgclient.impl.RowImpl cannot be cast to class io.vertx.mutiny.sqlclient.Row (io.vertx.pgclient.impl.RowImpl and io.vertx.mutiny.sqlclient.Row are in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @7fee8714)
	at io.quarkus.qe.GreetingResource.pool(GreetingResource.java:41)
	at io.quarkus.qe.GreetingResource$quarkusrestinvoker$pool_3981075bded2c418b48264dd951eb79f0020a332.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:183)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:645)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)


How to Reproduce?

  1. Create a quarkus app, with quarkus-rest and quarkus-reactive-pg-client extensions and example code
  2. Add the following imports:

import io.vertx.mutiny.sqlclient.Pool;
import io.vertx.mutiny.sqlclient.Row;
import io.vertx.mutiny.sqlclient.RowSet;
import io.vertx.mutiny.sqlclient.SqlConnection;

and endpoint

    @Inject
    Pool pool;

    @GET
    @Path("/pool")
    @Produces(MediaType.TEXT_PLAIN)
    public String pool() {
        SqlConnection connection = pool.getConnectionAndAwait();
        RowSet<Row> rows = connection.query("SELECT version();").executeAndAwait();
        System.out.println(rows.size());
        Row x = rows.stream().findFirst().get();
        System.out.println(x);
        System.out.println(x.getString(1));
        return "See logs";
    }
  1. Run the application in dev mode: mvn clean quarkus:dev
  2. Acess http://localhost:8080/pool

Output of uname -a or ver

6.16.12-200.fc42.x86_64"

Output of java -version

21.0.8, vendor: Eclipse Adoptium

Quarkus version or git rev

3.29.0

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

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)

Additional information

Looks similar to earlier #39659

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions