GWT - 带有类对象的RPC SerializationException

时间:2017-05-30 16:09:02

标签: java gwt gwt-rpc gwt-syncproxy

我目前正在尝试使用SyncProxy库来测试我的应用程序的服务,以便使用JMeter进行负载测试。该应用程序工作正常,我在localhost上运行它。

我已经设法做了一些调用,但只有当参数在哪里

这是错误:

  

键入' net.gicm.ector.shared.beans.Utilisateur'不包括在内   可以通过此SerializationPolicy序列化的类型集   无法加载其Class对象。出于安全考虑,此类型   不会被序列化。

以下是我拨打电话的代码:

 final Utilisateur user = new Utilisateur();
 user.setUser("C2984");

 TableauDeBordServiceAsync tableauDeBordServiceAsync = (TableauDeBordServiceAsync) SyncProxy
          .newProxyInstance(TableauDeBordServiceAsync.class, MODULE_BASE_URL, GET_SERVICE_NAME_2);
 tableauDeBordServiceAsync.ongletRealisationListeControle(plan, user, codeSI, numStructure, synthese, colonneAtrier, ordre, numeroPagination, filtre, new AsyncCallback<List<List<String>>>() {

    @Override
    public void onFailure(Throwable caught) {
        // TODO Auto-generated method stub
        System.out.println(caught);

    }

    @Override
    public void onSuccess(List<List<String>> result) {
        // TODO Auto-generated method stub
        System.out.println(result);

    }

 });

我查看了这个帖子,并试图找到我可以在哪里做错的事:https://stackoverflow.com/a/9534704/4628136

我的类实现了Serializable接口,有一个默认的空构造函数,并且在客户端包中。

public class Utilisateur implements Serializable {
   ...
   public Utilisateur() {
   }
   ...
}

但实际上,我在gwt.rpc文件中看不到有关Utilisateur类的任何内容。

2 个答案:

答案 0 :(得分:0)

我认为你需要实施

com.google.gwt.user.client.rpc.IsSerializable

你的课就像:

public class Utilisateur implements IsSerializable, Serializable {
   ...
   public Utilisateur() {
   }
   ...
}

答案 1 :(得分:0)

确保此类的所有属性也已序列化。

相关问题