1 year ago

#378558

test-img

Денис Завражнов

method has @XmlElementMapping on it, but it doesn't return a sub-type of JAXBElement

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

java

jboss

jaxb

jax-ws

cxf-codegen-plugin

0 Answers

Your Answer

Accepted video resources