Ryan Shoemaker - JavaSoft East said:
> Aaron Stromas wrote:
>
>> Greetings,
>>
>> I'm new to JAXP, and I've run into an error trying to generate code
>> from my schema. The schema is correct, validated by Xerces and XmlSpy,
>> but running xjc.sh fails:
>>
>> $ xjc.sh -xmlschema sps.xsd -b binding.xjb -d .
>> parsing a schema...
>> java.lang.reflect.InvocationTargetException
>> 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:324)
>> at
>> org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
>> Caused by: java.lang.NullPointerException
>> at
>> com.sun.tools.xjc.GrammarLoader.buildDOMForest(GrammarLoader.java:315)
>> at
>> com.sun.tools.xjc.GrammarLoader.loadXMLSchema(GrammarLoader.java:346)>> at
>> com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:125)
>> at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:71)
>> at com.sun.tools.xjc.Driver.run(Driver.java:192)
>> at com.sun.tools.xjc.Driver._main(Driver.java:82)
>> at com.sun.tools.xjc.Driver.access$000(Driver.java:48)
>> at com.sun.tools.xjc.Driver$1.run(Driver.java:62)
>>
>
> Aaron,
>
> This normally indicates a problem with the classpath, but since you're
> running xjc.sh it should be taking care of all the settings for you.
> Can you boil your schema down to a simple test case that reproduces the
> problem and send it to the list?
>
Ryan,
Admittedly my schema is quite large, but quite unexpectedly one of the toy
schemas I have around fails in the same way:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema targetNamespace="
http://localhost/test-1"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:sps-v1="
http://localhost/test-1"
elementFormDefault="qualified">
<xsd:simpleType name="VersionType">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="2147483647"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="GUIDType">
<xsd:annotation>
<xsd:documentation>36 Formatted Char. Guaranteed
Unique Identifier, Generated and formatted as DCE UUID</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:length value="36"/>
<xsd:pattern
value="[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="ExtractUploadRecord"
type="sps-v1:ExtractUploadRecordType"/>
<xsd:complexType name="ExtractUploadRecordType">
<xsd:sequence>
<xsd:element name="FixedString" type="xsd:anyType"
minOccurs="0" maxOccurs="2"/>
<xsd:element ref="sps-v1:Message" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Payload" type="sps-v1:PayloadType"/>
<xsd:complexType name="PayloadType">
<xsd:sequence>
<xsd:choice>
<xsd:element
ref="sps-v1:ExtractUploadRecord"/> <xsd:element name="CORoleRecord"
type="xsd:anyType"/>
<xsd:element name="RFCAdminRoleRecord"
type="xsd:anyType"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="PayloadToken"
type="sps-v1:PayloadTokenType" use="required"/>
</xsd:complexType>
<xsd:simpleType name="PayloadTokenType">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:enumeration value="DEORoleRecord"/>
<xsd:enumeration value="CORoleRecord"/>
<xsd:enumeration value="SystemRoleRecord"/>
<xsd:enumeration value="RFCAdminRoleRecord"/>
<xsd:enumeration value="ExtractUploadRecord"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="SPSMessage" type="sps-v1:SPSMessageType"/>
<xsd:complexType name="SPSMessageType">
<xsd:all>
<xsd:element ref="sps-v1:Payload"/>
</xsd:all>
</xsd:complexType>
<xsd:element name="Message" type="sps-v1:MessageType"/>
<xsd:complexType name="MessageType">
<xsd:all>
<xsd:element ref="sps-v1:SPSMessage"/>
</xsd:all>
<xsd:attribute name="FormatVersion"
type="sps-v1:VersionType" use="optional"/>
<xsd:attribute name="CorrelationID" type="sps-v1:GUIDType"
use="optional"/>
</xsd:complexType>
</xsd:schema>
Does it fail for you?
-a
--
Aaron Stromas | "Tik-tik-tik!!!... ja, Pantani is weg..."
mailto:ams_at_izoard.com | BRTN commentator
+1 (301) 493 4933 | L'Alpe d'Huez
http://www.izoard.com | 1995 Tour de France