Hi,
We are currently experimenting with JAXB with the intent of using
this technology in our products, however we are running into problems
when compiling xsd definitions into java classes. The problems persist
even when the sample schemas provided are used. The version of jaxb
that we are using is the following:
xjc version "JAXB 2.0 in JDK 1.6" JavaTM Architecture for XML
Binding(JAXB) Reference Implementation, (build JAXB 2.0 in JDK 1.6)
Description of the problem:
==================
As a test I started off with the po.xsd file in the "unmarshal-read"
sample directory. When I compile the xsd file with the command:
xjc po.xsd
...the following errors are reported
parsing a schema...
Exception in thread "main" java.lang.IllegalArgumentException:
http://www.w3.org/2001/XMLSchema
at
javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:181)
at
com.sun.tools.internal.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:62)
at
com.sun.tools.internal.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:329)
at com.sun.tools.internal.xjc.ModelLoader.load(ModelLoader.java:145)
at com.sun.tools.internal.xjc.ModelLoader.load(ModelLoader.java:91)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:287)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:173)
at com.sun.tools.internal.xjc.Driver._main(Driver.java:98)
at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:56)
at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:78)
... so I tried to reduce the validation level with the -nv flag by
running the command:
xjc -nv po.xsd
...and this time the compilation succeeded and the following files where
generated
parsing a schema...
compiling a schema...
generated\Items.java
generated\ObjectFactory.java
generated\PurchaseOrderType.java
generated\USAddress.java
After this first test I tried to compile the po.xsd found in the
inline-customize sample directory using the command:
xjc -nv po.xsd
...but again I get an error message as before (even with the nv flag
specified) as follows:
parsing a schema...
Exception in thread "main" java.lang.IllegalArgumentException:
http://www.w3.org/2001/XMLSchema
at
javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:181)
at
com.sun.tools.internal.xjc.SchemaCache.newValidator(SchemaCache.java:39)
at
com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1$1.startElement(AnnotationParserFactoryImpl.java:136)
at
com.sun.xml.internal.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:214)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.internal.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:271)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.internal.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:97)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.internal.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:172)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.internal.xjc.ModelLoader$SpeculationChecker.startElement(ModelLoader.java:427)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.internal.xjc.reader.internalizer.VersionChecker.startElement(VersionChecker.java:78)
at
org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
at
com.sun.xml.internal.xsom.parser.JAXPParser.parse(JAXPParser.java:79)
at
com.sun.tools.internal.xjc.ModelLoader$2.parse(ModelLoader.java:451)
at
com.sun.tools.internal.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:237)
at
com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:284)
at
com.sun.xml.internal.xsom.impl.parser.ParserContext.parse(ParserContext.java:87)
at
com.sun.xml.internal.xsom.parser.XSOMParser.parse(XSOMParser.java:147)
at
com.sun.tools.internal.xjc.ModelLoader.createXSOMSpeculative(ModelLoader.java:468)
at
com.sun.tools.internal.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:338)
at com.sun.tools.internal.xjc.ModelLoader.load(ModelLoader.java:145)
at com.sun.tools.internal.xjc.ModelLoader.load(ModelLoader.java:91)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:287)
at com.sun.tools.internal.xjc.Driver.run(Driver.java:173)
at com.sun.tools.internal.xjc.Driver._main(Driver.java:98)
at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:56)
at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:78)
I am starting to suspect that there is some problem with my version
of the jaxb compiler (I downloaded the jwsdp pack version 2 on Tuesday
21st August 2007). The xsd files seem to be ok. In addition, when
building the examples in the sample directory with ant I get the same
problems!
Has anyone come across similar problems and maybe can shed some light on
this issue.
Thanks in advance
Reuben Tonna.