Search code examples
javasqlcode-generationjooq

java.lang.ClassNotFoundException: org.jooq.util.JavaGenerator


I'm encountering the following exception after upgrading from jOOQ 3.10 to 3.11:

Caused by: java.lang.ClassNotFoundException: org.jooq.util.JavaGenerator
    at java.net.URLClassLoader.findClass (URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
    at org.jooq.codegen.GenerationTool.loadClass (GenerationTool.java:819)
    at org.jooq.codegen.GenerationTool.run (GenerationTool.java:329)
    at org.jooq.codegen.GenerationTool.generate (GenerationTool.java:220)
    at org.jooq.codegen.maven.Plugin.execute (Plugin.java:195)

What's the reason for this? Has this class been deleted?


Solution

  • Reusing org.jooq.util package names in older Java versions

    Older jOOQ versions had a package name conflict between the jooq and jooq-meta / jooq-codegen artefacts, which all reused the org.jooq.util package. This was OK in older versions of Java, up to Java 8.

    Forward compatibility for Java 9 / JPMS

    Under the JPMS, starting with Java 9, this is no longer allowed when running code on the module path (as opposed to the legacy classpath). For forwards compatibility, when jOOQ will be modularised, the offending packages in jooq-meta and jooq-codegen have been renamed: https://github.com/jOOQ/jOOQ/issues/7419

    Packages in the following code generation modules now have these prefixes:

    • jooq-meta: org.jooq.meta
    • jooq-meta-extensions: org.jooq.meta.extensions
    • jooq-codegen: org.jooq.codegen
    • jooq-codegen-maven: org.jooq.codegen.maven

    The jooq module (the runtime) did not change its package names.

    See also