javajooqvert.xjooq-codegen-mavenjooq-codegen

java.lang.NoSuchMethodError in jOOQ with Vertx


I'm trying to do CRUD operations using jOOQ generated DAO class. insert() works fine. But I'm getting following exception when I try to call findAll() method in jOOQ DAO class. What could be the reason for this error?

exception call stack

Here is how I call that method

Connection conn = DriverManager.getConnection(url, userName, password);
Configuration jooqConfiguration = new DefaultConfiguration().set(conn);
vehilceDao = new VehilceDao(jooqConfiguration, Vertx.currentContext().owner());

vehilceDao.findAll()
      .onComplete(result -> {
        if (result.succeeded()) {
          ...
        } else {
          ...
        }
      });

My pom.xml looks like this

  <dependencies>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit-jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit-jupiter.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-pg-client</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-sql-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jooq</groupId>
      <artifactId>jooq</artifactId>
      <version>3.16.4</version>
    </dependency>
    <dependency>
      <groupId>io.github.jklingsporn</groupId>
      <artifactId>vertx-jooq-classic-jdbc</artifactId>
      <version>6.5.5</version>
    </dependency>
    <dependency>
      <groupId>org.jooq</groupId>
      <artifactId>jooq-postgres-extensions</artifactId>
      <version>3.16.4</version>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jooq</groupId>
        <artifactId>jooq-codegen-maven</artifactId>
        <version>3.16.4</version>

        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>

        <dependencies>
          <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.6.0</version> <!-- Update to the latest version if needed -->
          </dependency>
          <dependency>
            <groupId>io.github.jklingsporn</groupId>
            <artifactId>vertx-jooq-generate</artifactId>
            <version>6.5.5</version>
          </dependency>
        </dependencies>

        <configuration>
          <jdbc>
            <driver>org.postgresql.Driver</driver>
            <url>jdbc:postgresql://localhost:5432/cars</url>
            <user>postgres</user>
            <password>postgres</password>
          </jdbc>

          <generator>
            <name>io.github.jklingsporn.vertx.jooq.generate.classic.ClassicJDBCVertxGenerator</name>
            <database>
              <name>org.jooq.meta.postgres.PostgresDatabase</name>
              <includes>.*</includes>
              <inputSchema>public</inputSchema>
              <unsignedTypes>false</unsignedTypes>
              <forcedTypes>
                <forcedType>
                  <name>BOOLEAN</name>
                  <types>(?i:SMALLINT)</types>
                </forcedType>
              </forcedTypes>
            </database>
            <target>
              <packageName>com.abc.generated</packageName>
              <directory>${project.basedir}/src/main/java</directory>
            </target>
            <generate>
              <interfaces>true</interfaces>
              <daos>true</daos>
              <fluentSetters>true</fluentSetters>
            </generate>
            <strategy>
              <name>io.github.jklingsporn.vertx.jooq.generate.VertxGeneratorStrategy</name>
            </strategy>
          </generator>

        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>17</source> <!-- Java version -->
          <target>17</target> <!-- Java version -->
          <release>17</release>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer
                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>${launcher.class}</Main-Class>
                    <Main-Verticle>${main.verticle}</Main-Verticle>
                  </manifestEntries>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
              <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar
              </outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin.version}</version>
        <configuration>
          <mainClass>io.vertx.core.Launcher</mainClass>
          <arguments>
            <argument>run</argument>
            <argument>${main.verticle}</argument>
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>

Solution

  • I'm answering because the Mark Rotteveel commented the correct answer. This is indeed a version mismatch. I changed to jOOQ version to 3.17.3 and problem fixed.