问题
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?
回答1:
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
- https://github.com/jOOQ/jOOQ/issues/7419
- https://github.com/etiennestuder/gradle-jooq-plugin/issues/71
- https://groups.google.com/forum/#!topic/jooq-user/-ILukM1EvlM
- https://groups.google.com/forum/#!topic/jooq-user/CRFH6qhh8Rk
来源:https://stackoverflow.com/questions/50793357/java-lang-classnotfoundexception-org-jooq-util-javagenerator