Looks like you don't have a default constructor. I believe you must
provide one for GWT to be able to serialize your objects.
Maybe you should look at:
http://java.sun.com/developer/technicalArticles/Programming/serialization/
and also the GWT developer guide.
I find it useful to create unit tests that confirm that objects will
serialize properly, because its really easy to overlook something (eg no
default constructor, mismatched getter/setter signature, final fields
etc etc.)
HTH
Alan
On 12/8/2011 2:47 AM, francescoNemesi wrote:
Hi,
when serializing an ArrayList of the bean below I get the following
error
Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
'xxxxxxx.CurrentLevel' 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 = xxxxxxx.CurrentLevel@1d008f5
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
615)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126)
at
com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:
45)
at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:
40)
at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
50)
at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
28)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
736)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
617)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126)
at
com.extjs.gxt.ui.client.data.RpcMap_CustomFieldSerializer.serialize(RpcMap_CustomFieldSerializer.java:
35)
Can anyone explain why? It is straightforward with only Integers and
Stings.
Thank You
import java.io.Serializable;
public class CurrentLevel implements Serializable{
private static final long serialVersionUID = -7742663738169565261L;
private String value;
private Integer levelNumber;
private String columnName;
private String columnFormat;
private String columnType;
public CurrentLevel() {
}
public CurrentLevel(String columnName, String columnFormat, String
columnType, String value) {
setColumnName(columnName);
setColumnFormat(columnFormat);
setColumnType(columnType);
setValue(value);
}
public CurrentLevel(String columnName, String columnFormat, String
columnType, String value,Integer levelNumber) {
this(columnName,columnFormat,columnType,value);
setLevelNumber(levelNumber);
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getLevelNumber() {
return levelNumber;
}
public void setLevelNumber(Integer levelNumber) {
this.levelNumber = levelNumber;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getColumnFormat() {
return columnFormat;
}
public void setColumnFormat(String columnFormat) {
this.columnFormat = columnFormat;
}
public String getColumnType() {
return columnType;
}
public void setColumnType(String columnType) {
this.columnType = columnType;
}
}
--
You received this message because you are subscribed to the Google Groups "Google
Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.