Results 1 to 3 of 3

Thread: Problem with Spring JAXB Version?

  1. #1
    Join Date
    Feb 2006
    Posts
    164

    Default Problem with Spring JAXB Version?

    Hi. I'm not sure yet if Spring is using an older? newer? version of JAXB, or there is some other JAXB config setting I'm missing. Anyway, the symptom is this:

    Using the airline project as a template, if I try to generate the JAXB source code for simpleTypes with enumerations, such as this:

    <code>
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace="http://www.uptodate.com"
    xmlns:tns="http://www.uptodate.com"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:simpleType name="YorNTyp">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="Y" />
    <xsd:enumeration value="N" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>
    </code>

    ...using Spring WS (recent download), JAXB doesn't generate the classes for the simpleTypes, and later, when I deploy the war, I get this error in the tomcat log:

    simpleType org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name ... to a(n) 'type definition' component

    ...since it can't find the class associated with the simpleType.

    However, if I create a test project in Eclipse, and use the JAXB from Sun's JWSDP2.0, it generates a YorNTyp.java, as I would expect.

    I notice that the airline.xsd contains a simpleType with enumeration, but that it is not prefixed, i.e. is using a default namespace, which I am not.

    This got me curious as to which version of JAXB Spring is using for the Web Services, but more importantly, how can I fix my problem without having to change my xml schema a lot?

    Ben

  2. #2
    Join Date
    Feb 2006
    Posts
    164

    Default

    In case someone else encounters this, changing the restriction base to "NCName" works around the problem. Ex:

    <simpleType name="YorNTyp">
    <restriction base="NCName">
    <enumeration value="Y" />
    <enumeration value="N" />
    </restriction>
    </simpleType>

    Not sure why yet, since base="NCName" is ultimately derived from base="string", according to my Xml Schema book.

    Ben

  3. #3
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    We actually use JAXB 2.0.1 from https://jaxb.dev.java.net/
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •