java - ERROR : Property appears in @XmlType. propOrder,但不存在此类属性

标签 java xml jaxb

尝试使用 JAXB 编码时出现异常。

这是堆栈跟踪:

javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 10 counts of IllegalAnnotationExceptions
Property authentication appears in @XmlType.propOrder, but no such property exists. Maybe you meant authentication?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property key appears in @XmlType.propOrder, but no such property exists. Maybe you meant key?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypePrimitiveField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestPrimitiveField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property objectKey appears in @XmlType.propOrder, but no such property exists. Maybe you meant objectKey?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObjectField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestObjectField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property objectsKey appears in @XmlType.propOrder, but no such property exists. Maybe you meant objectsKey?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObjectsField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestObjectsField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property object appears in @XmlType.propOrder, but no such property exists. Maybe you meant object?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObject
                                at protected com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObject com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObjectsField.objects
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeObjectsField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestObjectsField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property collectionsKey appears in @XmlType.propOrder, but no such property exists. Maybe you meant collectionsKey?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionsField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestCollectionsField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property collection appears in @XmlType.propOrder, but no such property exists. Maybe you meant collection?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollection
                                at protected com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollection com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionsField.collections
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionsField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestCollectionsField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property collectionKey appears in @XmlType.propOrder, but no such property exists. Maybe you meant collectionKey?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollection.collection
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollection
                                at protected com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollection com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionsField.collections
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeCollectionsField
                                at protected java.util.List com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.requestCollectionsField
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property username appears in @XmlType.propOrder, but no such property exists. Maybe you meant username?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAuthentication
                                at protected com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAuthentication com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest.authentication
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSRequest com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSRequest()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory
Property errorCode appears in @XmlType.propOrder, but no such property exists. Maybe you meant errorCode?
                this problem is related to the following location:
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSResponse
                                at public com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.TypeAorAgent2TTWSResponse com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory.createTypeAorAgent2TTWSResponse()
                                at com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects.ObjectFactory

TypeAorAgent2TTWSRequest.java

package com.alu.ipprd.aor310.ace.common.agt.jbpm.framework.tt.agt2tt.objects;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for type_aor_Agent2TTWS_Request complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="type_aor_Agent2TTWS_Request">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="authentication" type="{http://www.example.org/aor_Agent2TT_Interface}type_Authentication"/>
 *         &lt;element name="requestPrimitiveField" type="{http://www.example.org/aor_Agent2TT_Interface}type_PrimitiveField" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="requestObjectField" type="{http://www.example.org/aor_Agent2TT_Interface}type_ObjectField" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="requestObjectsField" type="{http://www.example.org/aor_Agent2TT_Interface}type_ObjectsField" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="requestCollectionsField" type="{http://www.example.org/aor_Agent2TT_Interface}type_CollectionsField" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "type_aor_Agent2TTWS_Request", propOrder = {
    "authentication",
    "requestPrimitiveField",
    "requestObjectField",
    "requestObjectsField",
    "requestCollectionsField"
})
@XmlRootElement(name = "aor_Agent2TTWS_Request")
public class TypeAorAgent2TTWSRequest {

    @XmlElement(required = true)
    protected TypeAuthentication authentication;
    protected List<TypePrimitiveField> requestPrimitiveField;
    protected List<TypeObjectField> requestObjectField;
    protected List<TypeObjectsField> requestObjectsField;
    protected List<TypeCollectionsField> requestCollectionsField;

    /**
     * Gets the value of the authentication property.
     * 
     * @return
     *     possible object is
     *     {@link TypeAuthentication }
     *     
     */
    public TypeAuthentication getAuthentication() {
        return authentication;
    }

    /**
     * Sets the value of the authentication property.
     * 
     * @param value
     *     allowed object is
     *     {@link TypeAuthentication }
     *     
     */
    public void setAuthentication(TypeAuthentication value) {
        this.authentication = value;
    }

    /**
     * Gets the value of the requestPrimitiveField property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the requestPrimitiveField property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getRequestPrimitiveField().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TypePrimitiveField }
     * 
     * 
     */
    public List<TypePrimitiveField> getRequestPrimitiveField() {
        if (requestPrimitiveField == null) {
            requestPrimitiveField = new ArrayList<TypePrimitiveField>();
        }
        return this.requestPrimitiveField;
    }

    /**
     * Gets the value of the requestObjectField property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the requestObjectField property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getRequestObjectField().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TypeObjectField }
     * 
     * 
     */
    public List<TypeObjectField> getRequestObjectField() {
        if (requestObjectField == null) {
            requestObjectField = new ArrayList<TypeObjectField>();
        }
        return this.requestObjectField;
    }

    /**
     * Gets the value of the requestObjectsField property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the requestObjectsField property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getRequestObjectsField().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TypeObjectsField }
     * 
     * 
     */
    public List<TypeObjectsField> getRequestObjectsField() {
        if (requestObjectsField == null) {
            requestObjectsField = new ArrayList<TypeObjectsField>();
        }
        return this.requestObjectsField;
    }

    /**
     * Gets the value of the requestCollectionsField property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the requestCollectionsField property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getRequestCollectionsField().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TypeCollectionsField }
     * 
     * 
     */
    public List<TypeCollectionsField> getRequestCollectionsField() {
        if (requestCollectionsField == null) {
            requestCollectionsField = new ArrayList<TypeCollectionsField>();
        }
        return this.requestCollectionsField;
    }

}

我引用了下面的链接,仍然不知道到底是什么问题:

JAXB IllegalAnnotationExceptions

最佳答案

您在属性中错过了 @XmlElement

@XmlElement(required = true)
protected TypeAuthentication authentication;
@XmlElement
protected List<TypePrimitiveField> requestPrimitiveField;
@XmlElement
protected List<TypeObjectField> requestObjectField;
@XmlElement
protected List<TypeObjectsField> requestObjectsField;
@XmlElement
protected List<TypeCollectionsField> requestCollectionsField;

关于java - ERROR : Property appears in @XmlType. propOrder,但不存在此类属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33169452/

相关文章:

java - Android 在应用程序上下文中保存图像

java - JAXB:第三方或外部父类(super class)上的@XmlTransient

java - JAXB 使用 namespace 解码..如何?

jaxb - XmlAccessType.FIELD 与 XmlAccessType.PROPERTY

java - Java Swing 中的 PNG 渲染错误(颜色深度低)

java - 为什么我的 java hibernate 应用程序不工作?

java - 为什么我用 Java 实现的快速排序不起作用?

android - 自定义小部件 : Error inflating class

java - 将示例请求 XML 从 wsdl 转换为 Java

c# - .NET 压缩 XML 以存储在 SQL Server 数据库中