I'm running codegen via Jibx maven pluginto generate Java source files
from xml schema (xsd) files. If I mix elements with "ref" and "type"
attributes inside the same element, Jibx crashes. The type is defined in
a separate file.
I get the followingerror message:
[ERROR] Failed to execute goal
org.jibx:jibx-maven-plugin:1.2.5:schema-codegen (default-cli) on project
tp4-portal: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.jibx:jibx-maven-plugin:1.2.5:schema-codegen
(default-cli) on project tp4-portal: null
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException
at
org.jibx.maven.AbstractCodeGenMojo.execute(AbstractCodeGenMojo.java:274)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at
org.jibx.runtime.impl.UTF8Escaper.writeAttribute(UTF8Escaper.java:68)
at
org.jibx.runtime.impl.GenericXMLWriter.writeAttributeText(GenericXMLWriter.java:209)
at
org.jibx.runtime.impl.XMLWriterBase.startTagNamespaces(XMLWriterBase.java:241)
at
org.jibx.runtime.impl.MarshallingContext.startTagNamespaces(MarshallingContext.java:950)
at
org.jibx.schema.codegen.SchemaDocumentationGenerator$DocumentationVisitor.visit(SchemaDocumentationGenerator.java:482)
at org.jibx.schema.SchemaVisitor.visit(SchemaVisitor.java:99)
at org.jibx.schema.SchemaVisitor.visit(SchemaVisitor.java:109)
at org.jibx.schema.SchemaVisitor.visit(SchemaVisitor.java:385)
at
org.jibx.schema.codegen.SchemaDocumentationGenerator$DocumentationVisitor.visit(SchemaDocumentationGenerator.java:551)
at org.jibx.schema.TreeWalker.walkElement(TreeWalker.java:194)
at
org.jibx.schema.codegen.SchemaDocumentationGenerator.generate(SchemaDocumentationGenerator.java:338)
at org.jibx.schema.codegen.ClassHolder.initClass(ClassHolder.java:679)
at
org.jibx.schema.codegen.StructureClassHolder.generate(StructureClassHolder.java:2111)
at
org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:210)
at
org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:227)
at org.jibx.schema.codegen.CodeGen.buildDataModel(CodeGen.java:1572)
at org.jibx.schema.codegen.CodeGen.generate(CodeGen.java:1781)
at org.jibx.schema.codegen.CodeGen.main(CodeGen.java:2206)
at
org.jibx.maven.AbstractCodeGenMojo.execute(AbstractCodeGenMojo.java:271)
... 21 more
In this run, I've only tried to use 2 input xsd files:
testTypes.xsd
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://mycompany.com/schema/resource"
targetNamespace="http://mycompany.com/schema/resource"
elementFormDefault="qualified">
<xs:complexType name="resourceType">
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
</xs:complexType>
</xs:schema>
test.xsd
--------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:r="http://mycompany.com/schema/resource"
elementFormDefault="qualified">
<xs:import namespace="http://mycompany.com/schema/resource"
schemaLocation="testTypes.xsd" />
<xs:element name="system">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" ref="features" />
<xs:element name="resource" minOccurs="0"
maxOccurs="unbounded" type="r:resourceType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="features">
<xs:complexType>
<xs:sequence>
<xs:element name="feature" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="available" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
This looks like a Jibx bug. If I'm doing something wrong here, please
tell me. Also, if I can provide more information to help, I'mwilling to
do it.
Regards,
Alan Evangelista
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users