Web服务传递对象错误

时间:2016-02-07 16:51:18

标签: java web-services

我正在尝试使用网络服务传递List<Object>,该列表来自Hibernate Criteria Search。

我的标准搜索代码是:

public class SeacrhUsers {    

    public static void main(String[] args) {
        Session ses  = Connection.Connection.getSessionFactory().openSession();
        Criteria cr = ses.createCriteria(DB.Vehicles.class);
        List prof = cr.list();
        //System.out.println(prof.size());
        hello(prof);
    }

    private static java.util.List<java.lang.Object> hello(java.util.List<java.lang.Object> user) {
        Task.NewWebService_Service service = new Task.NewWebService_Service();
        Task.NewWebService port = service.getNewWebServicePort();
        return port.hello(user);
    }
}

我得到了这个例外:

  

线程“main”中的异常javax.xml.ws.WebServiceException:javax.xml.bind.MarshalException     - 链接异常:   [com.sun.istack.SAXException2:类DB.Vehicles或其任何超类都是这个上下文已知的。   javax.xml.bind.JAXBException:类DB.Vehicles或其任何超类都是此上下文已知的。]       at com.sun.xml.ws.message.jaxb.JAXBMe​​ssage.writePayloadTo(JAXBMe​​ssage.java:424)       at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:192)       at com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:226)       在com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:144)       at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)       在com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:225)       在com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:145)       at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)       在com.sun.xml.ws.api.pipe.Fiber .__ doRun(Fiber.java:1136)       在com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)       在com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)       在com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)       在com.sun.xml.ws.client.Stub.process(Stub.java:463)       在com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)       at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)       at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)       在com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)       在com.sun.proxy。$ Proxy39.hello(未知来源)       在Model.SeacrhUsers.hello(SeacrhUsers.java:31)       在Model.SeacrhUsers.main(SeacrhUsers.java:25)   引起:javax.xml.bind.MarshalException

如何解决这个问题?任何建议。

0 个答案:

没有答案