JOOQ startup: NoClassDefFoundError Ex. on code generation

999 views
Skip to first unread message

FB

unread,
Mar 31, 2012, 1:59:20 PM3/31/12
to jOOQ User Group
Hello,

I'm new to JOOQ, I'm trying to generate the classes from the database
using this command (MAC OS):

java -classpath ~/Desktop/JOOQ/jooq-2.1.0.jar:~/Desktop/JOOQ/jooq-
meta-2.1.0.jar:~/Desktop/JOOQ/jooq-codegen-2.1.0.jar:~/Desktop/JOOQ/
mysql-connector-java-5.1.15-bin.jar:. org.jooq.util.GenerationTool /
bookstore.xml


This is my problem, I got NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jooq/
util/GenerationTool
Caused by: java.lang.ClassNotFoundException:
org.jooq.util.GenerationTool
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)



Thank you.
F.

Lukas Eder

unread,
Mar 31, 2012, 7:58:11 PM3/31/12
to jooq...@googlegroups.com
Hello Fabio,

This question is not really related to jOOQ, but to the way how Java
programs are generally started from the console. Obviously, your
classpath is not set up correctly (some typo in directory names? some
missing jar files? etc)

I'm not sure if I can help you there apart from pointing you at the
relevant manual page or the Java tutorial for starting Java programs:
http://www.jooq.org/manual/META/Configuration/
http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/classpath.html

Cheers
Lukas

2012/3/31 FB <fabio...@gmail.com>:

FB

unread,
Apr 1, 2012, 11:21:51 AM4/1/12
to jOOQ User Group
Ok thanks,

if I change the path removing ~/ and usign:

java -classpath /Users/fabio/Desktop/JOOQ/jooq-2.1.0.jar:/Users/fabio/
Desktop/JOOQ/jooq-meta-2.1.0.jar:/Users/fabio/Desktop/JOOQ/jooq-
codegen-2.1.0.jar:/Users/fabio/Desktop/JOOQ/mysql-connector-
java-5.1.15-bin.jar org.jooq.util.GenerationTool /Users/fabio/Desktop/
JOOQ/bookstore.xml

I got a different error:


Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Cannot find /Users/fabio/Desktop/JOOQ/bookstore.xml
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: -----------
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Please be sure it is located on the classpath and qualified as
a classpath location.
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: If it is located at the current working directory, try adding
a '/' to the path
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Usage : GenerationTool <configuration-file>

Lukas Eder

unread,
Apr 1, 2012, 11:36:17 AM4/1/12
to jooq...@googlegroups.com
Hello Fabio,

As documented in the manual and the tutorial, your XML configuration file needs to be located on the classpath:
http://www.jooq.org/tutorial.php
http://www.jooq.org/manual/META/Configuration/

Here are a couple of steps to follow (essentially, these are the tutorial steps):
1. put all jars and the XML file in a directory (let's say /Users/fabio/Desktop/JOOQ)
2. cd to that directory
3. run java -classpath jooq-2.1.0.jar:jooq-meta-2.1.0.jar:jooq-codegen-2.1.0.jar:mysql-connector-java-5.1.15-bin.jar org.jooq.util.GenerationTool /bookstore.xml

Note that "/bookstore.xml" means that bookstore.xml must be located at the root of your Java classpath, not at the root of your file system

2012/4/1 FB <fabio...@gmail.com>

FB

unread,
Apr 1, 2012, 11:51:50 AM4/1/12
to jOOQ User Group
Many thanks.
I found the problem: I missing point between the last jar file and the
declaration of the main class.

Thank you again for your time, JOOQ seems to be a really useful and
intuitive framework.

Regards, Fabio.

lokes...@greycode.in

unread,
Oct 4, 2017, 3:17:18 AM10/4/17
to jOOQ User Group
I am facing the following issue:
lokesh@lokesh-MS-7996:~/vertx$ npm start

> grey-bshlv@ start /home/lokesh/vertx
> vertx run server.js

Start Server
Succeeded in deploying verticle 
Loading Tables
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.jooq.impl.DefaultConfiguration
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397)
at jdk.nashorn.internal.scripts.Script$Recompilation$14$2235AAAAA$\^eval\_.L:33#_load(null:113)
at jdk.nashorn.internal.scripts.Script$Recompilation$4$4376AAAA$\^eval\_.L:33#doRequire(null:154)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:645)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptFunction.invokeSync(ScriptFunction.java:1294)
at jdk.nashorn.internal.scripts.Script$Recompilation$3$4049AAA$\^eval\_.L:33#Require(null:120)
at jdk.nashorn.internal.scripts.Script$Recompilation$18$2109A$\^eval\_.L:33#Module#require(null:68)
at jdk.nashorn.internal.scripts.Script$Recompilation$208$57AAAAA$\^eval\_#88\!17\^eval\_.L:1(/home/lokesh/vertx/verticles/tables/tables.js:5)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:647)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.internal.scripts.Script$Recompilation$14$2235AAAAA$\^eval\_.L:33#_load(null:113)
at jdk.nashorn.internal.scripts.Script$Recompilation$4$4376AAAA$\^eval\_.L:33#doRequire(null:154)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:645)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptFunction.invokeSync(ScriptFunction.java:1294)
at jdk.nashorn.internal.scripts.Script$Recompilation$3$4049AAA$\^eval\_.L:33#Require(null:120)
at jdk.nashorn.internal.scripts.Script$Recompilation$18$2109A$\^eval\_.L:33#Module#require(null:68)
at jdk.nashorn.internal.scripts.Script$Recompilation$206$15777A$\^eval\_#88\!17\^eval\_.L:1#L:440(/home/lokesh/vertx/server.js:443)
at jdk.nashorn.internal.scripts.Script$Recompilation$203$3127A$\^eval\_#88\!17\^eval\_.L:1#WorkerExecutor#executeBlocking#L:74(vertx-js/worker_executor.js:75)
at io.vertx.core.Handler$$NashornJavaAdapter.handle(Unknown Source)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
at io.vertx.core.impl.TaskQueue.lambda$new$0(TaskQueue.java:60)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.jooq.impl.DefaultConfiguration
at jdk.nashorn.internal.runtime.NativeJavaPackage.classNotFound(NativeJavaPackage.java:162)
at jdk.nashorn.internal.scripts.Script$Recompilation$217$57AAAAA$\^eval\_#88\!17\^eval\_.L:1(/home/lokesh/vertx/verticles/postgres-functions.js:3)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:647)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
... 26 more
Any idea how could I fix this issue ?
Regards 

Lukas Eder

unread,
Oct 4, 2017, 3:31:05 AM10/4/17
to jooq...@googlegroups.com
Hi Lokesh,

Thanks for your report. I'm not sure this is the same issue as the one originally reported. In any case, it looks as though jOOQ is not on your class path. You'll have to set up the dependencies correctly.

From what you posted so far, I can't say what went wrong, though.

Thanks,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages