Re: Serialization Error.... why??????

2011-12-08 Thread francescoNemesi
Thanks for your reply,

I am in dev mode with the internal Jetty I deleted all .rpc files,
but the problem persists...

On Dec 8, 12:07 pm, Jens jens.nehlme...@gmail.com wrote:
 Seems like your serialization policy file on your server is outdated (thats
 the hashcode.rpc file in your generated js folder, which should be
 available to the server and always be up-to-date). Do you use an external
 server? If so, redeploy your app. If you use the build-in Jetty server you
 may need to hit the Reload Web Server Button in Eclipse.

 I mostly see this exception when I modify/create serializable classes and
 then first redeploy to external server and then reload dev mode. That way I
 deploy an outdated policy file and when reloading dev mode a new one will
 be generated and I have to redeploy again. So you should always reload dev
 mode first and then redeploy.

 -- J.

-- 
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.



Re: Serialization Error.... why??????

2011-12-08 Thread Alan Chaney
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
'xxx.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 = xxx.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.