users@jersey.java.net

[Jersey] enum type JAXB error

From: Brendan cheng <ccp999_at_hotmail.com>
Date: Fri, 25 Nov 2011 09:23:10 +0000

Hi,
I've got this error:
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:179) at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:157) ... 22 moreCaused by: com.sun.istack.internal.SAXException2: class hk.itags.core.PersonPrivilegeRoles nor any of its super class is known to this context.javax.xml.bind.JAXBException: class hk.itags.core.PersonPrivilegeRoles nor any of its super class is known to this context. at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:234) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:249) at com.sun.xml.internal.bind.v2.runtime.property.SingleReferenceNodeProperty.serializeBody(SingleReferenceNodeProperty.java:102) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:321) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBean
 InfoImpl.java:317) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:317) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:581) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:309) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314) ... 26 moreCaused by: javax.xml.bind.JAXBException: class hk.itags.core.PersonPrivilegeRoles nor any of its super class is known to this context. at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:554) at com.sun.xml.internal.bind.v2.runtime.property.SingleReferenceNodeProperty.serializeBody(SingleReferenceNodeProperty.java:94) ... 33 more
and my hk.itags.core.PersonPrivilegeRoles class
public interface PrivilegeRoleType {}
@XmlRootElement
public enum PersonPrivilegeRoles implements PrivilegeRoleType {
        SystemAdmin, Owner, ServiceAdmin, Supervisor, Supporter, Colleague, Acquaintance, None
}
@XmlRootElement
public class Node {


        @XmlAnyElement
        public PrivilegeRoleType as;...}
@XmlRootElement
public class Person extends Node {
        public Person(){}
        public Person(int ID){ as = PersonPrivilegeRoles.Colleague;
How come I still get the errors?Any comment is highly appreciated!
Brendan