使用Jersey自动生成wadl时EnumMap中的NullPointerException

时间:2012-01-26 12:02:40

标签: jersey jaxb2 wadl

我正在使用Tomcat 7,Jaxb2和Jersey1.11。 我有一个EnumProperty类,它继承自一个抽象类Property。

@XmlAccessorType(XmlAccessType.FIELD)
public class EnumProperty extends Property<Enum> {
@XmlElement(name = "property_value", nillable = true)
private Enum value;

    public EnumProperty() {
        setValueType(PropertyValueTypeEnum.ENUM);
    }

    @Override
    public Enum getValue() {
        return value;
    }

    @Override
    public void setValue(Enum value) {
        this.value = value;
    }
}

Property类还有其他子类。另外,我有另一个类Entity,它拥有一组属性。我还有一个资源,它在其子资源之一中返回一个Collection。当我尝试生成我的应用程序wadl时,我收到NullPointerException。我将问题隔离到了EnumProperty类。谁能帮助我了解问题所在?

java.lang.NullPointerException
java.util.EnumMap.<init>(Unknown Source)
com.sun.xml.bind.v2.model.impl.RuntimeEnumLeafInfoImpl.<init>(RuntimeEnumLeafInfoImpl.java:87)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createEnumLeafInfo(RuntimeModelBuilder.java:109)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createEnumLeafInfo(RuntimeModelBuilder.java:85)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:228)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:213)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:99)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:319)
com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:96)
com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:73)
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:62)
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:55)
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:78)
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:81)
java.util.AbstractList$Itr.next(Unknown Source)...

0 个答案:

没有答案