Hi Rob,

I'll be happy to help you, but I think I'll need to get some help on how to
reproduce this. When reporting bugs, we usually ask people to report them
in the form of an "MCVE" (minimal, complete, verifiable example). We have a
template for that:
https://github.com/jOOQ/jOOQ-mcve

For example, I don't see how you set up your class path, if you're using
Gradle, or Maven, or something else, and how you're doing that, what
versions of jOOQ, code generator, and other third parties are involved, etc.

On Mon, Dec 7, 2020 at 8:08 PM Rob Sargent <[email protected]> wrote:

> I'm sure this is entirely a hole of my own digging, but I'm stuck, un-sure
> which part is broken.
>
> I started to move to java 15 but the code generation step failed.  However
> if I revert to java 11 I get the same error as follows:
>
> Dec 07, 2020 11:55:58 AM org.jooq.tools.JooqLogger warn
> WARNING: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 6235;
> cvc-complex-type.2.4.a: Invalid content was found starting with element '{
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:primaryKeyTypes}'. One
> of '{"http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:generatedAnnotationDate,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:constructorPropertiesAnnotation,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:constructorPropertiesAnnotationOnPojos,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:constructorPropertiesAnnotationOnRecords,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:pojosAsJavaRecordClasses,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:pojosAsScalaCaseClasses,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:pojosAsKotlinDataClasses,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:jpaVersion,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:globalDomainReferences,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:commentsOnEmbeddables,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:generatedSerialVersionUID,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:maxMembersPerInitialiser,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:newline,
> "http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd";
> <http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd>:indentation}' is
> expected.
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by
> com.sun.xml.bind.v2.runtime.reflect.opt.Injector (
> file:/home/rob/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-impl/2.3.0.1/2e979dabb3e5e74a0686115075956391a14dece8/jaxb-impl-2.3.0.1.jar)
> to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
> WARNING: Please consider reporting this to the maintainers of
> com.sun.xml.bind.v2.runtime.reflect.opt.Injector
> WARNING: Use --illegal-access=warn to enable warnings of further illegal
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Dec 07, 2020 11:55:59 AM org.jooq.tools.JooqLogger error
> SEVERE: Cannot read
> /home/rob/gits/gitlab/sgs4/jooq/build/tmp/generateJooq/config.xml. Error :
> Error generating code for catalog
> org.jooq.codegen.GeneratorException: Error generating code for catalog
>     at org.jooq.codegen.JavaGenerator.generate(JavaGenerator.java:441)
>     at org.jooq.codegen.GenerationTool.run0(GenerationTool.java:879)
>     at org.jooq.codegen.GenerationTool.run(GenerationTool.java:233)
>     at org.jooq.codegen.GenerationTool.generate(GenerationTool.java:228)
>     at org.jooq.codegen.GenerationTool.main(GenerationTool.java:200)
> Caused by: java.lang.NullPointerException
>     at org.jooq.codegen.JavaWriter.beforeClose(JavaWriter.java:227)
>     at org.jooq.codegen.GeneratorWriter.close(GeneratorWriter.java:339)
>     at
> org.jooq.codegen.JavaGenerator.closeJavaWriter(JavaGenerator.java:8566)
>     at
> org.jooq.codegen.JavaGenerator.generateCatalog(JavaGenerator.java:6253)
>     at org.jooq.codegen.JavaGenerator.generate(JavaGenerator.java:531)
>     at org.jooq.codegen.JavaGenerator.generate(JavaGenerator.java:436)
>     ... 4 more
>
> and I'm not sure which warning is, shall we say, understated.
>
I think both are just warnings. Look for the source of the NPE, instead.
But perhaps I'm mistaken - being able to reproduce this would help.


>   Is it the 'invalid content'
>
We evolve the XSD (and thus code generation config) as backwards compatibly
as possible. If schema validation is turned on, then new code generation
features that may not have been recognised by old versions of the code
generator will not pass by its validation. Maven doesn't care, but if
you're loading the XML file externally, validation is turned on by default.
So, there may be a wrong version of jOOQ on your classpath somewhere, but
that may be irrelevant to why code generation fails.

> or the 'Illegal reflective access'.
>
That's just a "bug" in a transitive dependency. jOOQ pulls in JAXB for
historic reasons, and they haven't fixed this yet.

See also:
https://github.com/jOOQ/jOOQ/issues/10926#issuecomment-726327489

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO5D8rziEKSyx8WPXH-vRuWhA-KMn5mXpSg%2BYyQ7aOiwqg%40mail.gmail.com.

Reply via email to