出错啦 出错啦 小伙伴们 求救!!求救
使用endpoint发布junit测试的时候没问题,用tomcat发布的没有报错,但测试的时候出错了求救求救
webservice java jaxws --------------------编程问答-------------------- java的问题去java版问。从异常上看是本地代理类和发来的数据不兼容。 --------------------编程问答-------------------- List中的元素无法转换
2013-11-17 22:03:46 com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
严重: caught throwable
javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: class org.zttc.vo.User以及其任何超类对此上下文都是未知的。]
at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:402)
at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:149)
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:127)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:285)
at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:421)
at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:99)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:650)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:218)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: class org.zttc.vo.User以及其任何超类对此上下文都是未知的。]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:276)
at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:104)
at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:145)
at com.sun.xml.ws.db.glassfish.BridgeWrapper.marshal(BridgeWrapper.java:170)
at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:393)
... 25 more
Caused by: javax.xml.bind.JAXBException: class org.zttc.vo.User以及其任何超类对此上下文都是未知的。
at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:247)
at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:262)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:169)
at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:159)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:358)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:271)
... 29 more
Caused by: javax.xml.bind.JAXBException: class org.zttc.vo.User以及其任何超类对此上下文都是未知的。
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:588)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
... 34 more
可以用@XmlSeeAlso注解,可以转换为json或xml输出。
这是你需要修改的地方:
@XmlRootElement(name="PaginationSupport")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({User.class})
public class PaginationSupport implements java.io.Serializable{
。。。
}
出处 --------------------编程问答-------------------- --------------------编程问答--------------------
补充:.NET技术 , Web Services