Monday, October 19, 2009

CXF JAX-RS IllegalAnnotationException - Class has two properties of the same name

I am currently using Apache CXF to provide RESTful web services for the Australian PhenomeBank.

I was attempting to assign annotations of private field members of a class as follows:

    @XmlElement(name="mutationType")
    @XmlElementWrapper(name="mutationTypes")
    private Set<MutationType> mutationTypes  = EnumSet.noneOf(MutationType.class);

What I had forgot to do was assign the XmlAccessorType as follows:

@XmlRootElement(name="SearchCriteria")
@XmlAccessorType(XmlAccessType.FIELD)
public class SearchCriteria

4 comments: