Home > Software engineering >  jOOQ throws class file for java.util.concurrent.Flow not found for where condition
jOOQ throws class file for java.util.concurrent.Flow not found for where condition

Time:03-23

I'm using delete and update methods that uses 'where' function of jOOQ:

public static void delete(DSLContext context, Table<? extends Record> table, Condition condition) {
    context.delete(table)
            .where(condition)
            .execute();
}

In jOOQ file, it throws error at DeleteWhereStep - @CheckReturnValue DeleteConditionStep where(Condition var1);

I am getting java: cannot access java.util.concurrent.Flow class file for java.util.concurrent.Flow not found error at the where(condition) point.

The versions I'm using is - jooq, jooq-meta, jooq-codegen, jooq-meta-extensions-liquibase: 3.15.5

Please help.

CodePudding user response:

The error isn't related to your specific query, but to your dependency management.

The java.util.concurrent.Flow class has been added to the JDK 9 only, it was not yet available in the JDK 8. Starting from jOOQ 3.15, the jOOQ Open Source Edition had a Java 11 baseline and thus a direct dependency on JDK 11 API, including Flow. If you wish to continue working with Java 8 and jOOQ 3.15, you will need to upgrade to the commercial distributions, which have continued support for Java 8. You can find jOOQ's Java version support matrix here: https://www.jooq.org/download/versions

A common reason why you might still be accidentally pulling the jOOQ Open Source Edition dependency and thus run into this error, despite using the commercial editions, could be related to using a third party dependency management framework, such as Spring Boot, which defaults to depending on the jOOQ Open Source Edition. This blog post explains how to work around that: https://blog.jooq.org/how-to-use-jooqs-commercial-distributions-with-spring-boot/

Also, make sure you're using the right dependencies both in your code generation setup as well as at runtime, as you can see in this section of the manual.

It says:

<!-- Specify the maven code generator plugin -->
<!-- Use org.jooq                for the Open Source Edition
         org.jooq.pro            for commercial editions with Java 17 support, 
         org.jooq.pro-java-11    for commercial editions with Java 11 support,
         org.jooq.pro-java-8     for commercial editions with Java 8 support,
         org.jooq.trial          for the free trial edition with Java 17 support, 
         org.jooq.trial-java-11  for the free trial edition with Java 11 support, 
         org.jooq.trial-java-8   for the free trial edition with Java 8 support 
         
     Note: Only the Open Source Edition is hosted on Maven Central. 
           Import the others manually from your distribution -->
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.16.5</version>

So you need to pick either:

  • <groupId>org.jooq.pro-java-8</groupId> if you're already licensed
  • <groupId>org.jooq.trial-java-8</groupId> if you're trying out jOOQ

Alternatively, if you wish to work with the jOOQ Open Source Edition, you'll have to revert to a 3.14 release, which still used Java 8 as a baseline - or, why not just take the opportunity to upgrade to Java 17...

  • Related