我在RPC调用中有一个SerializationException
GWT版本是:2.4.0。
Extjs.gxt lib版本是:gxt-2.3.1-gwt22。
如果我在tomcat 7中部署我的应用程序,它可以工作,不是玻璃鱼 - 没有
请帮帮我。
服务器 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$8.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)
我的班级:
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上 - 这个例外 我不知道该怎么办,请帮帮我。 感谢。
答案 0 :(得分:0)
我遇到了同样的问题,但在我的情况下只是在devmode。所有RPC规则都放在生成的&#34; rpc&#34;文件夹,您应检查您的服务器上是否可用且实际可用。从服务器上抛出的问题也可以简单地调试它,问题应该是某个地方GWT采用rpc策略并根据你的请求进行匹配。
P.S。 根据我的经验,避免这些情况的最佳方法是不要使用GXT类作为dto对象,尤其是GXT 2类。
答案 1 :(得分:0)
我解决了这个问题 在WEB-INF / lib文件夹中是一个jetty libs。当我删除这些文件时 - 一切正常 感谢。