JAXB Annotations and SuperClass
I'm trying to use JAXB annotations in a parent class so that all the sub classes can inherit them but I'm running into a marshaling error. I don't get the below error when I include @XmlRootElement and @XmlAccessorType(XmlAccessType.FIELD) in the sub class
error: HTTP Status 500 - Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml
@MappedSuperclass
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
开发者_如何学Pythonpublic class Parent {
//class contents here
}
public class Child extends Parent{
//class contents here
}
You have to list all of your subclasses in @XmlSeeAlso annotation of your parent class.
精彩评论