View Full Version : RPC SerializationException

21 Dec 2010, 3:44 AM
I've already read some other threads on this forum related to SerializationException, but I couldn't find a solution to my problem beacuse I work with deferred binding.

Running my project I get:

Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'net.cooparcobaleno.shared.Customer' 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 = net.cooparcobaleno.shared.Customer@117bb9c
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:614)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126)

What does it mean?
Here my code:

This is the domain object:

public class Customer implements Serializable{

private static final long serialVersionUID = 2448840201911034453L;

private String name;
private String email;
private int age;

public Customer(String name, String email, int age) {
this.name = name;
this.email = email;
this.age = age;

public String getName() {
return name;

public void setName(String name) {
this.name = name;

public String getEmail() {
return email;

public void setEmail(String email) {
this.email = email;

public int getAge() {
return age;

public void setAge(int age) {
this.age = age;


I also tried IsSerializable instead of Serializable interface. The problem was not solved.

The beanmodel:

import com.extjs.gxt.ui.client.data.BeanModelMarker;
import com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN;

public interface CustomerBeanModel extends BeanModelMarker {


My async interface:

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface ExampleServiceAsync {

public void getCustomers(AsyncCallback<List<Customer>> callback);


My service interface:

public interface ExampleService extends RemoteService {

public List<Customer> getCustomers();


My service implementation:

public class ExampleServiceImpl extends RemoteServiceServlet implements ExampleService {

private static final long serialVersionUID = -4715995642155136251L;

public List<Customer> getCustomers() {

List<Customer> customers = new ArrayList<Customer>();

Customer c1 = new Customer("Gino", "gino", 2);
Customer c2 = new Customer("Paolo", "paolo", 33);


return customers;


My entry point class:

public class EsempioGrid implements EntryPoint {

public static final String SERVICE = GWT.getModuleBaseURL() + "service";

public void onModuleLoad() {

final ExampleServiceAsync service = (ExampleServiceAsync) GWT.create(ExampleService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = SERVICE;
Registry.register(SERVICE, service);

RpcProxy<List<Customer>> proxy = new RpcProxy<List<Customer>>() {
public void load(Object loadConfig, AsyncCallback<List<Customer>> callback) {
BeanModelReader reader = new BeanModelReader();

// loader and store
ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);


// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("name", "Name", 200));
columns.add(new ColumnConfig("email", "Email", 100));
columns.add(new ColumnConfig("age", "Age", 50));
ColumnModel cm = new ColumnModel(columns);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);

ContentPanel panel = new ContentPanel();
panel.setHeading("BeanModel Grid Example");
panel.setSize(400, 200);

// panel.setIcon(Resources.ICONS.table());
panel.setLayout(new FitLayout());


My GWT xml:

<module rename-to='esempiogrid'>
<source path='client'/>
<source path='shared'/>
<inherits name="com.extjs.gxt.ui.GXT"/>
<entry-point class="net.cooparcobaleno.client.EsempioGrid"/>

and finally my web.xml with service declaration:


Please how can I solve this problem?
Thank you

21 Dec 2010, 3:50 AM
This is more or a less a GWT question and not a GXT one. Your Customer class does nto have a default (empty) contructor, which is needed for RPC.

21 Dec 2010, 3:59 AM
sven, writing

public Customer() {}

it works!

Thank you.

11 Feb 2011, 5:05 AM