您的当前位置:首页正文

解决WebService :nor any of its super class is known to this context

2022-01-23 来源:步旅网


问题:WebService客户端连接调试时,出现以下问题。

javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException

- with linked exception:

[javax.xml.bind.JAXBException: class com.lonhwin.client.Persion nor any of its super class is known to this context.]

at

com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:322)

at

com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)

at

com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)

at

com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)

at

com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPip

e.java:142)

at com.sun.xml.xwss.XWSSClientPipe.process(XWSSClientPipe.java:118)

at

com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)

at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)

at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)

at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)

at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)

at com.sun.xml.ws.client.Stub.process(Stub.java:248)

at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)

at

com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)

at

com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)

at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)

at $Proxy33.newSaveT(Unknown Source)

at com.lonhwin.manager.MyClient.main(MyClient.java:20)

Caused by: javax.xml.bind.MarshalException

可以参考http://blog.csdn.net/chen_yu_ting/article/details/6606494

或者 http://learning.iteye.com/admin/blogs/1216342

一,遇到此问题是因为我直接把自定义对象放到ArrayList里面,然后返回这个ArrayList出的问题,提示说

class com.test.xxx nor any of its super class is known to this context. 按照上面连接里描述的 多创建了一个辅助类,把ArrayList封装在这个类中 返回这个封装类即可

上面是使用jdk自带的webservice api出的问题

二,如果是用CXF出现 nor any of its super class is known to this context,你需要指明集合里面存放的具体类型

比如说你调用webservice传的是List

1,

List list =new ArrayList();

list.add(对象A);

如果直接把list传过去就会出现以上问题

2,List<对象A> list =new ArrayList<对象A>();

list.add(对象A);

这样就OK了

因篇幅问题不能全部显示,请点此查看更多更全内容