Reputation: 9559
I have been following a tutorial here
As it stands, it works fine.
But if I try to convert a class hierarchy to XML, I get exceptions
Example:
@XmlRootElement(name = "stuff")
public class Stuff {
@XmlMixed
public List<Other> getList(){
return records;
}
}
Other class:
@XmlRootElement(name="other")
public class Other {
@XmlAttribute int foo;
}
And the important part of the exception:
class mypackage.Other nor any of its super class is known to this context.
Upvotes: 0
Views: 148
Reputation: 3320
here's a quick workaround:
Add :
@XmlSeeAlso(Other.class) to Stuff .
You should check the following posts for more insights
javax.xml.bind.JAXBException: Class *** nor any of its super class is known to this context
JAXB Exception: Class not known to this context
Upvotes: 1