users@jaxb.java.net

XmlElementRef points to a non-existent class

From: Mitch Claborn <mitch_at_claborn.net>
Date: Wed, 30 Jan 2008 14:57:54 -0600

I'm trying to use @XmlElementRef to get a collection of objects with a
common parent class, very similar to the Ant example in the doc:
https://jaxb.dev.java.net/nonav/2.1.6/docs/api/javax/xml/bind/annotation/XmlElementRef.html

For now, not using a schema - although I will once I get past this hurdle.

The code compiles OK, but at runtime I get

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
XmlElementRef points to a non-existent class.
    this problem is related to the following location:
        at private java.util.List com.csc.survey.Page.questionObjects
        at com.csc.survey.Page
        at private java.util.Vector com.csc.survey.PageLoop.pages
        at com.csc.survey.PageLoop
        at private java.util.Vector com.csc.survey.Section.pageLoops
        at com.csc.survey.Section
        at private java.util.Vector com.csc.survey.Survey.sections
        at com.csc.survey.Survey


Code fragments:

@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name="page")
@XmlRootElement(name="page")
public class Page implements Routable, Cloneable {
  @XmlElementRef
    private List<QuestionObject> questionObjects;
   
   
abstract public class QuestionObject {
  public QuestionObject() {
  }
}


@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name="question")
public class Question extends QuestionObject implements Cloneable,
Sequencable {



-- 
Mitch Claborn
mitch_at_claborn.net