Error Using Code Generator in 2.3

83 views
Skip to first unread message

name256

unread,
May 21, 2012, 7:03:46 AM5/21/12
to jooq...@googlegroups.com
Hi,

I have just downloaded 2.3 and I am having a torrid time running the code generator. I seem to have forgotten how I ran it the last time I used JOOQ. I have followed the instructions on the manual to the letter but when i run "java -classpath jooq-2.3.0.jar:jooq-codegen-2.3.0.jar:jooq-meta-2.3.0.jar:mysql-connector-java-5.1.13-bin.jar:. org.jooq.util.GenerationTool /guestbook.xml", I get the result below:

0    [main] ERROR org.jooq.util.GenerationTool  - Cannot find /guestbook.xml
1    [main] ERROR org.jooq.util.GenerationTool  - -----------             
1    [main] ERROR org.jooq.util.GenerationTool  - Please be sure it is located on the classpath and qualified as a classpath location.
1    [main] ERROR org.jooq.util.GenerationTool  - If it is located at the current working directory, try adding a '/' to the path
1    [main] ERROR org.jooq.util.GenerationTool  - Usage : GenerationTool <configuration-file>

Kindly assist.

Lukas Eder

unread,
May 21, 2012, 7:29:30 AM5/21/12
to jooq...@googlegroups.com
Is guestbook.xml located on the classpath? In your case, it would have
to be located in the current working directory ".". On a Linux/Unix
environment, you should be able to see this:

$ cd my-jooq-test-dir
$ ls
guestbook.xml jooq-2.3.0.jar jooq-codegen-2.3.0.jar
jooq-meta-2.3.0.jar mysql-connector-java-5.1.13-bin.jar

And if you see all of the above, then you can run the following (as you tried):

$ java -classpath
jooq-2.3.0.jar:jooq-codegen-2.3.0.jar:jooq-meta-2.3.0.jar:mysql-connector-java-5.1.13-bin.jar:.
org.jooq.util.GenerationTool /guestbook.xml

Cheers
Lukas

2012/5/21 name256 <abel....@gmail.com>:

Abel Birya

unread,
May 21, 2012, 7:36:33 AM5/21/12
to jooq...@googlegroups.com
Hi Lukas,

Thanks for your reply. It's been a while. I hope you are carrying on well.

Actually this is the surprising thing because when I run the ls command, this is what I have:

guestbook.xml  jooq-2.3.0.jar  jooq-codegen-2.3.0.jar  jooq-console-2.3.0.jar  jooq-meta-2.3.0.jar  log4j.xml  mysql-connector-java-5.1.13-bin.jar.

All the required files are present in the directory that I am using to run the code generation from.

I have been at this since morning and I guess I have just run out of ideas as to what is going wrong.

Kind regards

Lukas Eder

unread,
May 21, 2012, 7:41:48 AM5/21/12
to jooq...@googlegroups.com
Hmm, that is odd. Well the GenerationTool code for loading that file
is straightforward:

public static void main(String[] args) throws Exception {
if (args.length < 1) {
error();
}

InputStream in = GenerationTool.class.getResourceAsStream(args[0]);

if (in == null) {
log.error("Cannot find " + args[0]);
// [...]

As you can see, this can only be because Java cannot load the file
from the classpath. Did you check access flags (i.e. what do you get
when running "ls -l .")

Cheers
Lukas

2012/5/21 Abel Birya <abel....@gmail.com>:

Abel Birya

unread,
May 21, 2012, 7:50:55 AM5/21/12
to jooq...@googlegroups.com
Permissions are the first thing I changed to ensure that the files were readable. Below is my ls -l dump:

rwxrwxrwx 1 abel abel    1944 2012-05-21 14:06 guestbook.xml
-rwxr-xr-x 1 abel abel  739437 2012-05-06 20:39 jooq-2.3.0.jar
-rwxr-xr-x 1 abel abel   59046 2012-05-06 20:39 jooq-codegen-2.3.0.jar
-rwxr-xr-x 1 abel abel 1811955 2012-05-06 20:39 jooq-console-2.3.0.jar
-rwxr-xr-x 1 abel abel  426133 2012-05-06 20:39 jooq-meta-2.3.0.jar
-rwxrwxrwx 1 abel abel     896 2012-05-21 13:22 log4j.xml

Regards Abel

Lukas Eder

unread,
May 21, 2012, 7:58:45 AM5/21/12
to jooq...@googlegroups.com
OK, I guess this is somethings silly then. I have two more ideas,
although they might not work either:

- Put the "." at the beginning of your classpath, i.e. "-classpath
.:jooq-2.4.0.jar ..."
- Put the guestbook.xml file in a subdir and load it from
"/subdir/guestbook.xml"

Abel Birya

unread,
May 21, 2012, 8:05:43 AM5/21/12
to jooq...@googlegroups.com
Hey Lukas,

Not working either.

Cheers.

Lukas Eder

unread,
May 21, 2012, 11:32:28 AM5/21/12
to jooq...@googlegroups.com
Hi Abel,

As an alternative, have you tried using Maven for source code
generation? An sample pom.xml file for jooq-codegen-maven can be seen
here:
https://github.com/jOOQ/jOOQ/blob/master/jOOQ-codegen-maven-example/pom.xml

Abel Birya

unread,
May 22, 2012, 12:20:26 AM5/22/12
to jooq...@googlegroups.com

Hi Lukas,

Haven't tried it yet. I've never been a big fan of maven but at this point I'm willing to try anything. I'll update you on my progress in the course of the day.

Cheers.

Lukas Eder

unread,
May 22, 2012, 3:37:20 AM5/22/12
to jooq...@googlegroups.com
Before digging into maven, you could just try to reproduce your own
little Java file using the GenerationTool's main() method to read and
print out the XML configuration file. Maybe you can debug and step
through it to find out what might be going wrong...?

2012/5/22 Abel Birya <abel....@gmail.com>:

Abel Birya

unread,
May 22, 2012, 3:46:34 AM5/22/12
to jooq...@googlegroups.com
Hi Lukas,

I guess we are a bit too late for that :-D. I have generated many of the files that are needed using Maven. The project I am undertaking has very tight deadlines therefore I may not be able to do the debugging immediately but I promise to allocate it time in about a weeks time. Thanks once more for taking the time to assist.

Kind regards.
Abel

Lukas Eder

unread,
May 22, 2012, 3:47:56 AM5/22/12
to jooq...@googlegroups.com
> I guess we are a bit too late for that :-D. I have generated many of the
> files that are needed using Maven. The project I am undertaking has very
> tight deadlines therefore I may not be able to do the debugging immediately
> but I promise to allocate it time in about a weeks time. Thanks once more
> for taking the time to assist.

Great, well at least it finally worked! :-)

Cheers
Lukas
Reply all
Reply to author
Forward
0 new messages