Announcement Announcement Module
No announcement yet.
Problem with Spring JAXB Version? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema targetNamespace=""

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

    ...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, 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?


  • #2
    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" />

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



    • #3
      We actually use JAXB 2.0.1 from