如何从服务器检索数据到客户端查看

时间:2016-06-22 03:00:30

标签: java gwt

当我从服务器(或RPC调用)检索数据到客户端视图时,它将显示以下错误。

在端口0上启动Jetty    [WARN]调度传入的RPC调用时发生异常 com.google.gwt.user.client.rpc.SerializationException:键入' org.itrosys.igpstrack.shared.model.Device _ $$ _ javassist_8'未包含在可由此SerializationPolicy序列化的类型集中,或者无法加载其Class对象。出于安全考虑,此类型不会被序列化:instance = org.itrosys.igpstrack.shared.model.Device@49a6f77b     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)     在com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter $ ValueWriter $ 8.write(ServerSerializationStreamWriter.java:153)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:757)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:796)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:669)     在com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)     在com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:44)     在com.google.gwt.user.client.rpc.core.java.util.LinkedList_CustomFieldSerializer.serialize( LinkedList_CustomFieldSerializer.java:39)     在com.google.gwt.user.client.rpc.core.java.util.LinkedList_CustomFieldSerializer.serializeInstance( LinkedList_CustomFieldSerializer.java:51)     在com.google.gwt.user.client.rpc.core.java.util.LinkedList_CustomFieldSerializer.serializeInstance( LinkedList_CustomFieldSerializer.java:28)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:788)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:669)     在com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter $ ValueWriter $ 8.write(ServerSerializationStreamWriter.java:153)     在com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)     在com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:605)     在com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:471)     在com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:563)     在com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:265)     在com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:305)     在com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:755)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:848)     在org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)     在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)     在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)     在org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)     在org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)     在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)     在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)     在org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)     在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)     在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)     at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)     在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)     在org.eclipse.jetty.server.Server.handle(Server.java:370)     at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)     at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)     at org.eclipse.jetty.server.AbstractHttpConnection $ RequestHandler.content(AbstractHttpConnection.java:1021)     在org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)     在org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)     at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)     在org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)     在org.eclipse.jetty.io.nio.SelectChannelEndPoint $ 1.run(SelectChannelEndPoint.java:52)     在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:543)

1 个答案:

答案 0 :(得分:1)

您尝试获取的数据类型必须是可序列化的。来自GWT documentartion

类型是可序列化的,如果满足下列条件之一,则可以在服务接口中使用:

  • 默认情况下,所有基本类型(int,char,boolean等)及其包装器对象都是可序列化的。
  • 可序列化类型的数组可通过扩展名进行序列化。
  • 如果一个类满足以下三个要求,则可以序列化:
    • 它直接实现Java Serializable或GWT IsSerializable接口,或者因为它派生自一个超类。
    • 其非最终的非瞬态实例字段本身可序列化,
    • 它有一个带有任何访问修饰符的默认(零参数)构造函数(例如私有Foo(){}将起作用)