Announcement Announcement Module
Collapse
No announcement yet.
Spring, Roo,and JAXBException: X nor any of its super class is known to this context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring, Roo,and JAXBException: X nor any of its super class is known to this context

    How do I use Spring to force all my marshaling to use the same context and to find all my classes (which may be in different jars)?

    I originally posted this in the Roo forum but have not seen a reply, so I'm trying here since I see more JAXB threads here.

    I can only get Jaxb2 marshaling to work for my container class (a Java generic type, Container<T>) if I
    also list the classes I use with it in an @XmlSeeAlso annotation. I.e. if my app wants to marshal
    a Container<Link> I must use
    Code:
    @XmlSeeAlso({Link.class})
    in my Container class. If not, marshaling fails with JAXBException: Link nor any of its super class is known to this context

    I list the classes in the jaxb.Jaxb2Marshaller bean's classesToBeBound
    as per http://static.springsource.org/sprin...#oxm-jaxb2-xsd
    but that does not work.

    I also tried
    Code:
    <oxm:jaxb2-marshaller id="marshaller" contextPath="com.sas.tools.appgen.models:com.sas.commons.rest"/>
    and adding explicit com/sas/commons/rest/jaxb.index files, i.e.

    Code:
    Container
    Link
    (and both my Container and my Link are in the same jar) but I continue to get this JAXBException unless I explicitly list the classes in @XmlSeeAlso, which is not a solution in the general case because the Container class does not know all the types it will be instantiated with (i.e. Container<MyOtherType>, Container<YourType>.

    thanks!
Working...
X