EMF with GWT and serialize problems

50 views
Skip to first unread message

Guillen Antonio

unread,
Aug 25, 2020, 11:11:53 AM8/25/20
to GWT Users
HI all,

I use GWT 2.81 and EMF (Eclipse Modeling Framework) when i want send from the server to the client an object of my model, I obtain this final error:
com.google.gwt.user.client.rpc.SerializationException: Type 'com.lacen.organisation.impl.RequirementImpl' 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 = com.lacen.organisation.impl.RequirementImpl@2fa144e7 (name: Fkygrdphgf)

I have tried to understand how to use serializationWhitelist but I have no clear example.  The class RequirementImpl contains List, so I tried to create ArrayList with the good type, but same pb.

Can you help me, at least give me where found a claer explanation.

Tanks a lot
Antonio Guillen

Jens

unread,
Aug 26, 2020, 3:29:33 AM8/26/20
to GWT Users
RequirementImpl must implement serializable, needs to have a default constructor (visibility does not matter), no final fields and there must be at least one serializable type found for each field that can be assigned to that field (which must meet the same requirements). Also if you do not transfer RequirementImpl directly but instead an interface that RequirementImpl implements, then GWT Compiler needs to see the class+source of RequirementImpl so it can treat RequirementImpl as a possible concrete type that might be transferred. 

Have you double checked these requirements? 

-- J.

Guillen Antonio

unread,
Aug 26, 2020, 9:06:19 AM8/26/20
to GWT Users
HI Jens,

Thanks for your help. I don't understand this sentence " Also if you do not transfer RequirementImpl directly but instead an interface that RequirementImpl implements, then GWT Compiler needs to see the class+source of RequirementImpl so it can treat RequirementImpl as a possible concrete type that might be transferred. " What do you understand?
I had also read stuff on whiteList but I don't understand what means this WhiteList? Do you know this?

Regards
Antonio

Jens

unread,
Aug 27, 2020, 7:47:36 AM8/27/20
to GWT Users

Thanks for your help. I don't understand this sentence " Also if you do not transfer RequirementImpl directly but instead an interface that RequirementImpl implements, then GWT Compiler needs to see the class+source of RequirementImpl so it can treat RequirementImpl as a possible concrete type that might be transferred. " What do you understand?

What I meant is that you might not use RequirementImpl directly as a field type if RequirementImpl implements an interface. For example it you have 

interface Requirement extends Serializable {

}

class RequirementImpl implements Requirement {
 
...
}

class SomeClassToTransferWithGWT implements Serializable {
 
private Requirement requirement;

 
....
}



then RequirementImpl must be visible to the GWT compiler.

 
I had also read stuff on whiteList but I don't understand what means this WhiteList? Do you know this?

Whitelist is just the list of classes that GWT-RPC allows to transfer. It is generated by GWT by looking at the classes reachable from your GWT-RPC service. To add something explicitly to the "whitelist" you need to add a new dummy method to your GWT-RPC service that uses the classes you want to add to the whitelist as parameter or return type.


-- J. 
Reply all
Reply to author
Forward
0 new messages