当前位置: 首页 > 知识库问答 >
问题:

错误:属性出现在@XmlType中。但不存在这样的属性

尉迟韬
2023-03-14

我在尝试使用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

键入AORAGENT2TTWSREQUEST。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非法注释例外

共有1个答案

融宏伟
2023-03-14

您的属性中缺少@xmlement

@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;
 类似资料:
  • 问题内容: 我刚刚开始使用最新的Java7 SDK在IntelliJ中构建JavaFX应用程序。 我已经使用Oracle Scene Builder构建了界面,所有内容都可以运行并在预览中显示良好,但是当我尝试编译程序时,出现以下错误 根据JavaFX Documentation判断,我的FXML中的行似乎无效。 有人知道我为什么收到此错误吗?(如果我删除了指向样式表的链接,则程序可以正常编译,因

  • 我在使用: null null 令人惊讶的是,但是toModel方法工作得很好,编译后,我在生成的源代码中看到了下面的内容: 我不知道如何修复这个映射问题。有人能帮忙吗? 下面是我的映射器:

  • 采用这种方法: 我不会写: 因为它似乎依赖于访问器方法被命名为。是否可以使用代替?

  • 我正面临这个来自kubernetes集群的错误。虽然它在我的本地服务器上运行得很好。这是我的SpringBoot应用程序的application.yml 这是我的光配置。 我已经检查了没有Hikari的kubernetes的DB连通性,它工作得很完美。因此连接性没有问题。请帮我解决这个问题。这几天我都被困住了。谢谢你

  • 日志消息如下所示: 2018-09-24 13:49:23,669错误O.A.J.M.JSR223预处理器:JSR223脚本中的问题,JSR223预处理器javax.script.scriptexception:groovy.lang.missingPropertyException:没有这样的属性:用于类的it:Script32 at org.codehaus.groovy.JSR223.gro

  • 我已将TS添加到我的React/Redux应用程序中。 我在我的应用程序中使用对象,如下所示: TS抛出一个错误: 类型脚本错误:类型“窗口”上不存在属性“FB”。TS2339 我想修正这个错误。 我在这里找到了答案https://stackoverflow.com/a/56402425/1114926 为什么第一个版本不起作用,而第二个版本起作用,尽管我根本没有指定FB属性?