PDA

View Full Version : Serializable



flyingbo
7 May 2009, 9:55 PM
Hi @ all,

i´ve got this error message, after calling a rpc.

Type 'foo.bar.client.model.Field' 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.
public class Field extends BaseModel implements IsSerializable{
private static final long serialVersionUID = 01;

public Field(){
}

public String getName() {
return get("name");
}
public void setName(String name) {
set("name",name);
}
public String getDataType() {
return get("dataType");
}
public void setDataType(String dataType) {
set("dataType",dataType);
}
public Boolean getMultiple() {
return get("multiple");
}
public void setMultiple(Boolean multiple) {
set("multiple",multiple);
}
public String getFormatString() {
return get("formatString");
}
public void setFormatString(String formatString) {
set("formatString",formatString);
}
public List<String> getListValues() {
return get("listValues");
}
public void setListValues(List<String> listValues) {
set("listValues",listValues);
}
}
Can anybody help me? I don´t know whats wrong, but i think the rules to make an object serializable are implemented.
I´m beginner in programming Ext GWT. ;)

Best Wishes
Chris

flyingbo
8 May 2009, 12:02 AM
I forget:
The Field-Class is used by the Archive-Class.



public class Archive extends BaseModel implements IsSerializable{
private static final long serialVersionUID = 01;

public Archive(){
}

public String getName() {
return (String)get("name");
}
public void setName(String name) {
set("name",name);
}
public String getAlias() {
return (String)get("alias");
}
public void setAlias(String alias) {
set("alias",alias);
}
public Boolean getUploadRight() {
return (Boolean)get("uploadRight");
}
public void setUploadRight(Boolean uploadRight) {
set("uploadRight",uploadRight);
}
public List<Field> getFields() {
return (List<Field>)get("fields");
}
public void setFields(List<Field> fields) {
set("fields",fields);
}
public List<Integer> getUpload() {
return (List<Integer>)get("upload");
}
public void setUpload(List<Integer> upload) {
set("upload",upload);
}
public List<Integer> getSearch() {
return (List<Integer>)get("search");
}
public void setSearch(List<Integer> search) {
set("search",search);
}
public List<Integer> getPreview() {
return (List<Integer>)get("preview");
}
public void setPreview(List<Integer> preview) {
set("preview",preview);
}
public List<Integer> getHitlist() {
return (List<Integer>)get("hitlist");
}
public void setHitlist(List<Integer> hitlist) {
set("hitlist",hitlist);
}
}
I retrieve Archive´s from the server and after adding Field´s in to Archives i get the error message.

FireGlow
23 Jun 2009, 10:33 AM
Same Problem for me , found any solution?

jschwarz0
23 Jun 2009, 4:11 PM
I use "Serializable" not "IsSerializable" as that seems to be the new way:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/d4330f6e240c76a4?pli=1

thus my RPC class looks like this:

public class Store implements Serializable

don't forget to make a default constructor

/**
* required for Serializable
*/
public Store()
{
}

If that is still broken, try it without inheriting BaseModel, maybe that is the problem.(?)

YMMV,

Jim

Colin Alworth
25 Jun 2009, 12:41 PM
In Archive, try adding an unused field:

private Field _field;

The issue is that from your RPC and model object fields GWT cant figure out that the Field class could be sent over the wire. Rather than make everything available via RPC, GWT picks the smallest set of classes possible. This unused field is enough to explain your intentions.