0

I am getting error with new JDBCClient API.

java.lang.NoClassDefFoundError: io/agroal/api/configuration/supplier/AgroalDataSourceConfigurationSupplier

Created project from starter, included jdbc-client and H2 database API.

JDBCPool pool = JDBCPool.pool(
      vertx,
      // configure the connection
      new JDBCConnectOptions()
        // H2 connection string
        .setJdbcUrl("jdbc:h2:~/test")
        // username
        .setUser("sa")
        // password
        .setPassword(""),
      // configure the pool
      new PoolOptions()
        .setMaxSize(16)
    );

while retrieving connection getting NoClassDefFoundError

Ravat Tailor
  • 1,193
  • 3
  • 20
  • 44

1 Answers1

1

Given that the vert.x client requires a pool, all pool implementations are marked as optional dependencies and your build tool does not pull it to your project. Which means you need to explicitly add it; otherwise you will see that error. For this case, you will need:

io.agroal:agroal-api1.16
io.agroal:agroal-pool:1.16

For the future, the plan is to rely just on a javax.sql.DataSource and keep the pool agnostic. Most pools do implement this interface, so users are free to choose to use a pool or not.

Paulo Lopes
  • 5,845
  • 22
  • 31
  • I see some intermittent issues with queries, some times all queries got executed successfully and sometime few get executed. – Ravat Tailor Jul 11 '22 at 07:01