GWT:调度 com.extjs.gxt.ui.client.data.BaseListLoadResult 的传入 RPC 调用时出现异常
GWT: Exception while dispatching incoming RPC call for com.extjs.gxt.ui.client.data.BaseListLoadResult
我在 RPC 调用中有一个 SerializationException。
GWT 版本为:2.4.0.
Extjs.gxt lib版本为:gxt-2.3.1-gwt22.
如果我在 tomcat 7 中部署我的应用程序,它会工作,但在 glassfish 中 - 不。
请帮帮我。
服务器是 Glassfish v3.
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.extjs.gxt.ui.client.data.BaseListLoadResult' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.extjs.gxt.ui.client.data.BaseListLoadResult@5dc57a
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter.write(ServerSerializationStreamWriter.java:153)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:605)
at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:471)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:563)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:211)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:251)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
我的class是:
public interface UnitServiceAsync {
void findAll(AsyncCallback<ListLoadResult<OrgUnitDTO>> callback);
}
@RemoteServiceRelativePath("Unit")
public interface UnitService extends RemoteService {
ListLoadResult<OrgUnitDTO> findAll();
}
public class PersistenceService extends RemoteServiceServlet {
...
}
及其实现:
public class UnitServiceImpl extends PersistenceService implements UnitService {
private static final long serialVersionUID = -1433248587426826168L;
@Override
public ListLoadResult<OrgUnitDTO> findAll() {
...
List<OrgUnitDTO> subList = new ArrayList<OrgUnitDTO>();
...
return new BaseListLoadResult<OrgUnitDTO>(subList);
}
}
public class OrgUnitDTO extends BaseModel implements IsSerializable {
private static final long serialVersionUID = 2392916533158255302L;
//getters
//setters
public OrgUnitDTO() {}
}
我经历了很多解决方案,例如:
class 应实现 Serializable 或 IsSerrializable 接口,应提供默认构造函数等。
最有趣的是,在 tomcat 上它对我来说工作正常,但在 glassfish 上 - 这个例外。
我不知道该怎么办,请帮助我。
谢谢
我遇到过同样的问题,但就我而言,只是在开发模式下。所有 RPC 规则都放在生成的 "rpc" 文件夹中,您应该检查它在您的服务器上是否可用和实际。此外,服务器抛出的问题您可以简单地对其进行调试,问题应该出在 GWT 采用 rpc 策略并根据您的请求匹配它们的地方。
P.S。
根据我的经验,避免这些情况的最好方法是不要使用 GXT 类 作为 dto 对象,尤其是 GXT 2 类.
我解决了这个问题。
在 WEB-INF/lib 文件夹中是一个码头库。当我删除这个库时 - 一切正常。
谢谢。
我在 RPC 调用中有一个 SerializationException。
GWT 版本为:2.4.0.
Extjs.gxt lib版本为:gxt-2.3.1-gwt22.
如果我在 tomcat 7 中部署我的应用程序,它会工作,但在 glassfish 中 - 不。
请帮帮我。
服务器是 Glassfish v3.
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.extjs.gxt.ui.client.data.BaseListLoadResult' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.extjs.gxt.ui.client.data.BaseListLoadResult@5dc57a
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter.write(ServerSerializationStreamWriter.java:153)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:605)
at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:471)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:563)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:211)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:251)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
我的class是:
public interface UnitServiceAsync {
void findAll(AsyncCallback<ListLoadResult<OrgUnitDTO>> callback);
}
@RemoteServiceRelativePath("Unit")
public interface UnitService extends RemoteService {
ListLoadResult<OrgUnitDTO> findAll();
}
public class PersistenceService extends RemoteServiceServlet {
...
}
及其实现:
public class UnitServiceImpl extends PersistenceService implements UnitService {
private static final long serialVersionUID = -1433248587426826168L;
@Override
public ListLoadResult<OrgUnitDTO> findAll() {
...
List<OrgUnitDTO> subList = new ArrayList<OrgUnitDTO>();
...
return new BaseListLoadResult<OrgUnitDTO>(subList);
}
}
public class OrgUnitDTO extends BaseModel implements IsSerializable {
private static final long serialVersionUID = 2392916533158255302L;
//getters
//setters
public OrgUnitDTO() {}
}
我经历了很多解决方案,例如:
class 应实现 Serializable 或 IsSerrializable 接口,应提供默认构造函数等。
最有趣的是,在 tomcat 上它对我来说工作正常,但在 glassfish 上 - 这个例外。
我不知道该怎么办,请帮助我。
谢谢
我遇到过同样的问题,但就我而言,只是在开发模式下。所有 RPC 规则都放在生成的 "rpc" 文件夹中,您应该检查它在您的服务器上是否可用和实际。此外,服务器抛出的问题您可以简单地对其进行调试,问题应该出在 GWT 采用 rpc 策略并根据您的请求匹配它们的地方。
P.S。 根据我的经验,避免这些情况的最好方法是不要使用 GXT 类 作为 dto 对象,尤其是 GXT 2 类.
我解决了这个问题。
在 WEB-INF/lib 文件夹中是一个码头库。当我删除这个库时 - 一切正常。
谢谢。