2
votes

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)
public class Parent {

//class contents here
}

public class Child extends Parent{

//class contents here
}
1
What does the JAX-RS method annotated with @GET return ArrayList<Parent>, ArrayList<Child>, or ArrayList?bdoughan

1 Answers

7
votes

You have to list all of your subclasses in @XmlSeeAlso annotation of your parent class.