问题描述
使用endpoint发布junit测试的时候没问题,用tomcat发布的没有报错,但测试的时候出错了求救求救2013-11-1722:03:46com.sun.xml.ws.transport.http.servlet.WSServletDelegatedoGet严重:caughtthrowablejavax.xml.ws.WebServiceException:javax.xml.bind.MarshalException-withlinkedexception:[javax.xml.bind.JAXBException:classorg.zttc.vo.User以及其任何超类对此上下文都是未知的。]atcom.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:402)atcom.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:149)atcom.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:127)atcom.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:285)atcom.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:421)atcom.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:99)atcom.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:650)atcom.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263)atcom.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:218)atcom.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)atcom.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)atcom.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:643)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:723)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)atjava.lang.Thread.run(Thread.java:662)Causedby:javax.xml.bind.MarshalException-withlinkedexception:[javax.xml.bind.JAXBException:classorg.zttc.vo.User以及其任何超类对此上下文都是未知的。]atcom.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:276)atcom.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:104)atcom.sun.xml.bind.api.Bridge.marshal(Bridge.java:145)atcom.sun.xml.ws.db.glassfish.BridgeWrapper.marshal(BridgeWrapper.java:170)atcom.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:393)...25moreCausedby:javax.xml.bind.JAXBException:classorg.zttc.vo.User以及其任何超类对此上下文都是未知的。atcom.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:247)atcom.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:262)atcom.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)atcom.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:169)atcom.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:159)atcom.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:358)atcom.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)atcom.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:271)...29moreCausedby:javax.xml.bind.JAXBException:classorg.zttc.vo.User以及其任何超类对此上下文都是未知的。atcom.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:588)atcom.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)...34more
解决方案
解决方案二:
java的问题去java版问。从异常上看是本地代理类和发来的数据不兼容。
解决方案三:
List中的元素无法转换可以用@XmlSeeAlso注解,可以转换为json或xml输出。这是你需要修改的地方:@XmlRootElement(name="PaginationSupport")@XmlAccessorType(XmlAccessType.FIELD)@XmlSeeAlso({User.class})publicclassPaginationSupportimplementsjava.io.Serializable{。。。}
解决方案四:
解决方案五:
解决方案六:
不知道楼主搞出来了吗/?能给说说看嘛?