简体   繁体   中英

nor any of its super class is known to this context in jaxb

Im getting below exception when trying send a soap request through stubs.

    [com.sun.istack.internal.SAXException2: class com.domain.Test nor any of its super class is known to this context.
    javax.xml.bind.JAXBException: class com.domain.Test nor any of its super class is known to this context.]
at com.sun.xml.internal.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:408)
    at com.sun.xml.internal.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:173)
    at com.sun.xml.internal.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:206)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:129)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:227)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:210)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)

The way im executing this is

NmsRtEvent event = new NmsRtEvent(); // WebServiceClient
RtEventMethodsSoap methodsSoap = event.getRtEventMethodsSoap(); //WebService
Element element = new Element();
element.setAny(new Test());
plId = methodsSoap.pushEvent(token,element);

Test class

@XmlType(namespace = "http://www.test.com/test")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class Test implements Serializable{

    private int id;

}

Thanks

Java doc says about @XmlSeeAlso -

Instructs JAXB to also bind other classes when binding this class.

You used annotation @XmlSeeAlso with Test.class values, its not correct. It should other class that need to be bind when you bind Test class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM