When I use XJC 2.1.12 to parse and generate Java classes from my
Schema then all works fine -
CORP\aretter_at_exd-010933:/usr/local/jaxb-ri-20090708$ xjc -debug
-verbose ~/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterResponse.xsd
parsing a schema...
compiling a schema...
[INFO] generating code
unknown location
JAXBDebug.java
dclg_cepc/commonstructures/MessageIdentifier.java
dclg_cepc/commonstructures/ObjectFactory.java
dclg_cepc/commonstructures/ReportRetrievalType.java
dclg_cepc/commonstructures/package-info.java
dclg_cepc/ACIRecommendation.java
<SNIP/>
CORP\aretter_at_exd-010933:/usr/local/jaxb-ri-20090708$
But when I try and use the jaxb2 maven plugin in my project the
parsing of that Schema fails with this error -
[jaxb2:generate]
Started execution.
JAXB API is loaded from the
[jar:file:/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/rt.jar!].
Detected JAXB API version [2.1].
pluginArtifacts:[org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-raw:jar:0.7.2:runtime,
org.codehaus.plexus:plexus-utils:jar:1.1:runtime,
org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.3.1:runtime,
com.sun.xml.bind:jaxb-impl:jar:2.1.12:runtime,
javax.xml.bind:jaxb-api:jar:2.1:runtime,
javax.xml.stream:stax-api:jar:1.0-2:runtime,
javax.activation:activation:jar:1.1:runtime,
org.jvnet.jaxb2_commons:jaxb2-basics-jaxb-xjc:jar:2.1.12:runtime,
com.sun.codemodel:codemodel:jar:2.2:runtime,
com.sun.xml.dtd-parser:dtd-parser:jar:1.0:runtime,
com.sun.istack:istack-commons-tools:jar:1.1:runtime,
relaxngDatatype:relaxngDatatype:jar:20020414:runtime,
com.sun.org.apache.xml.internal:resolver:jar:20050927:runtime,
org.kohsuke.rngom:rngom:jar:20061207:runtime,
com.sun.xsom:xsom:jar:20081112:runtime]
schemaLanguage:null
schemaDirectory:/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd
schemaIncludes:[Ljava.lang.String;@758689a
schemaExcludes:null
bindingDirectory:/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd
bindingIncludes:[Ljava.lang.String;@3d3b5a3a
bindingExcludes:null
disableDefaultExcludes:false
catalog:null
catalogResolver:com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver
generatePackage:null
generateDirectory:/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/target/generated-sources/xjc
readOnly:false
extension:false
strict:true
writeCode:true
verbose:true
debug:false
args:[]
forceRegenerate:false
removeOldOutput:false
otherDepends:null
episodeFile:/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/target/generated-sources/xjc/META-INF/sun-jaxb.episode
episode:true
classpathElements:[/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/target/classes]
plugins:null
episodes:null
xjcPlugins:null
episodes:null
specVersion:2.1
schemaFiles (calculated):[/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/rest/LodgementResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/BaseDataTypes.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Input-Data.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Performance-Summary.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Reported-Data.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/CEPC-Reports.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Report-Header.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CommonFiles/CommonStructures.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CommonFiles/Exceptions.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CIP.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ExternalDefinitions.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/UpdateEARegisterRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/LodgeReportRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/UpdateEARegisterResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/LodgeReportResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ChangeReportStatusRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ChangeReportStatusResponse.xsd]
bindingFiles (calculated):[/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CIP.xjb]
xjcPluginArtifacts (resolved):[]
xjcPluginFiles (resolved):[]
xjcPluginURLs (resolved):[]
episodeArtifacts (resolved):[]
episodeFiles (resolved):[]
The schemaLanguage setting was not defined, assuming 'AUTODETECT'.
Cannot find CatalogManager.properties
Using java.util.ServiceLoader
Checking up-to-date depends
[[/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/rest/LodgementResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/BaseDataTypes.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Input-Data.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Performance-Summary.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Reported-Data.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/CEPC-Reports.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Reports/Report-Header.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CommonFiles/CommonStructures.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CommonFiles/Exceptions.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CIP.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ExternalDefinitions.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/UpdateEARegisterRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/LodgeReportRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/UpdateEARegisterResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/LodgeReportResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ChangeReportStatusRequest.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/ChangeReportStatusResponse.xsd,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/CIP.xjb,
/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/pom.xml]].
Checking up-to-date produces [[]].
Depends timestamp [1262604263000], produces timestamp [null].
Parsing input schema(s)...
[ERROR]Error while parsing schema(s).Location [
file:/home/CORP/aretter/NetBeansProjects/new-registers/Non-Domestic-England-And-Wales-Register/src/main/webapp/xsd/Messages/GetStatusEARegisterResponse.xsd{19,89}].
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name
'CEPC:CertificateNumberType' to a(n) 'type definition' component.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2537)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1472)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:369)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:121)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSeqChoice(XSDAbstractParticleTraverser.java:216)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSequence(XSDAbstractParticleTraverser.java:146)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:971)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexContent(XSDComplexTypeTraverser.java:774)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:260)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(XSDComplexTypeTraverser.java:133)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:356)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:121)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSeqChoice(XSDAbstractParticleTraverser.java:216)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSequence(XSDAbstractParticleTraverser.java:146)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:971)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:279)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(XSDComplexTypeTraverser.java:133)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:356)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:2049)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:582)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:210)
at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:101)
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:357)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:167)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:113)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.loadModel(RawXJC2Mojo.java:630)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:258)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:134)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
My maven pom looks like this -
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<schemaDirectory>${project.basedir}/src/main/webapp/xsd</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
<include>*/*.xsd</include>
</schemaIncludes>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
Any thoughts?
--
Adam Retter
skype :adam.retter
http://www.adamretter.org.uk