简体   繁体   中英

GWT - RPC SerializationException with class object

I am currently trying to use the SyncProxy library to test services of my app, in order to do load testing with JMeter. The app works fine, I am running it on localhost.

I already managed to make some calls, but only when the parameters where

this is the error :

Type 'net.gicm.ector.shared.beans.Utilisateur' 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.

Here is the piece of code where I make the call :

 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);

    }

 });

I looked at this thread, and tried to find where could I do something wrong : https://stackoverflow.com/a/9534704/4628136

My class implements the Serializable interface, has a default empty constructor, and is in the client package.

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

But actually, I don't see anything about that Utilisateur class in the gwt.rpc files.

I think you need to implement

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

Your class would be like:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM