方法上有@xmlelementMapping,但它没有返回Jaxbelement的子类型

发布于 01-19 02:45 字数 5763 浏览 2 评论 0原文

我正在尝试在 JBOSS EAP 7.2 上部署我的 Web 服务。 但在部署阶段我收到错误。我的 ObjectFactory 类在 createCertificateTypeSerialNumber 方法中没有返回 JAXBElement 吗?

Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:
7 counts of IllegalAnnotationExceptions
The createCertificateTypeSerialNumber method has @XmlElementMapping on it, but it doesn't return a sub-type of JAXBElement. this problem is related to the following location:
    at @javax.xml.bind.annotation.XmlElementDecl(namespace=, substitutionHeadName=, substitutionHeadNamespace=##default, defaultValue=, scope=class com.icl.isesb.ws.CertificateType, name=serialNumber)
    at public javax.xml.bind.JAXBElement com.icl.isesb.ws.ObjectFactory.createCertificateTypeSerialNumber(java.lang.String)
    at com.icl.isesb.ws.ObjectFactory
    at protected java.util.List com.icl.isesb.ws.CertificateType.content
    at com.icl.isesb.ws.CertificateType
    at protected com.icl.isesb.ws.CertificateType com.icl.isesb.ws.GetCertificateResponse.certificate
    at com.icl.isesb.ws.GetCertificateResponse
    ...

我的 ObjectFactory.class:

@XmlRegistry
public class ObjectFactory {
    private final static QName _CertificateTypeSerialNumber_QNAME = new QName("", "serialNumber");
    private final static QName _CertificateTypeSubjectDN_QNAME = new QName("", "subjectDN");
    private final static QName _CertificateTypeIssuerDN_QNAME = new QName("", "issuerDN");
    private final static QName _CertificateTypeSubjectKeyIdentifier_QNAME = new QName("", "subjectKeyIdentifier");
    private final static QName _CertificateTypeAuthorityKeyIdentifier_QNAME = new QName("", "authorityKeyIdentifier");
    private final static QName _CertificateTypeCertString_QNAME = new QName("", "certString");
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "serialNumber", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSerialNumber(String value) {
        return new JAXBElement<String>(_CertificateTypeSerialNumber_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "subjectDN", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSubjectDN(String value) {
        return new JAXBElement<String>(_CertificateTypeSubjectDN_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "issuerDN", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeIssuerDN(String value) {
        return new JAXBElement<String>(_CertificateTypeIssuerDN_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "subjectKeyIdentifier", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSubjectKeyIdentifier(String value) {
        return new JAXBElement<String>(_CertificateTypeSubjectKeyIdentifier_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "authorityKeyIdentifier", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeAuthorityKeyIdentifier(String value) {
        return new JAXBElement<String>(_CertificateTypeAuthorityKeyIdentifier_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "certString", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeCertString(String value) {
        return new JAXBElement<String>(_CertificateTypeCertString_QNAME, String.class, CertificateType.class, value);
    }

}

我做错了什么?

我尝试将 cxf codegenplugin 更改为 3.5.1

I am trying to deploy my web service on JBOSS EAP 7.2.
But at the deployment stage I get an error. Doesn't my ObjectFactory class return a JAXBElement in the createCertificateTypeSerialNumber method?

Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:
7 counts of IllegalAnnotationExceptions
The createCertificateTypeSerialNumber method has @XmlElementMapping on it, but it doesn't return a sub-type of JAXBElement. this problem is related to the following location:
    at @javax.xml.bind.annotation.XmlElementDecl(namespace=, substitutionHeadName=, substitutionHeadNamespace=##default, defaultValue=, scope=class com.icl.isesb.ws.CertificateType, name=serialNumber)
    at public javax.xml.bind.JAXBElement com.icl.isesb.ws.ObjectFactory.createCertificateTypeSerialNumber(java.lang.String)
    at com.icl.isesb.ws.ObjectFactory
    at protected java.util.List com.icl.isesb.ws.CertificateType.content
    at com.icl.isesb.ws.CertificateType
    at protected com.icl.isesb.ws.CertificateType com.icl.isesb.ws.GetCertificateResponse.certificate
    at com.icl.isesb.ws.GetCertificateResponse
    ...

My ObjectFactory.class:

@XmlRegistry
public class ObjectFactory {
    private final static QName _CertificateTypeSerialNumber_QNAME = new QName("", "serialNumber");
    private final static QName _CertificateTypeSubjectDN_QNAME = new QName("", "subjectDN");
    private final static QName _CertificateTypeIssuerDN_QNAME = new QName("", "issuerDN");
    private final static QName _CertificateTypeSubjectKeyIdentifier_QNAME = new QName("", "subjectKeyIdentifier");
    private final static QName _CertificateTypeAuthorityKeyIdentifier_QNAME = new QName("", "authorityKeyIdentifier");
    private final static QName _CertificateTypeCertString_QNAME = new QName("", "certString");
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "serialNumber", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSerialNumber(String value) {
        return new JAXBElement<String>(_CertificateTypeSerialNumber_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "subjectDN", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSubjectDN(String value) {
        return new JAXBElement<String>(_CertificateTypeSubjectDN_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "issuerDN", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeIssuerDN(String value) {
        return new JAXBElement<String>(_CertificateTypeIssuerDN_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "subjectKeyIdentifier", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeSubjectKeyIdentifier(String value) {
        return new JAXBElement<String>(_CertificateTypeSubjectKeyIdentifier_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "authorityKeyIdentifier", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeAuthorityKeyIdentifier(String value) {
        return new JAXBElement<String>(_CertificateTypeAuthorityKeyIdentifier_QNAME, String.class, CertificateType.class, value);
    }
    
    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     * 
     * @param value
     *     Java instance representing xml element's value.
     * @return
     *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
     */
    @XmlElementDecl(namespace = "", name = "certString", scope = CertificateType.class)
    public JAXBElement<String> createCertificateTypeCertString(String value) {
        return new JAXBElement<String>(_CertificateTypeCertString_QNAME, String.class, CertificateType.class, value);
    }

}

what i do wrong?

i try to change cxf codegenplugin to 3.5.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文