2015-10-16 41 views
3

尝试使用JAXB编组时遇到了异常。错误:属性出现在@ XmlType.propOrder中,但不存在此类属性

这里是堆栈跟踪:

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

回答

4

你错过了你的属性@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; 
+0

感谢@Jens,它的工作原理:-) – dev

相关问题