com.google.gwt.user.client.rpc.SerializationException

When getting the following exception while fetching objects to the front end:

Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'org.datanucleus.store.appengine.query.StreamingQueryResult' 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.


Even when I know the object is Serializable....

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class RecipeStep implements Serializable
{
    public RecipeStep()
    {
    }



All I had to do is to REWRITE the returned LIST:

    public List<RecipeStep> fetch(Long recipeId)
    {
      ...
    steps = (List<RecipeStep>) pm.newQuery(query).execute();
...


List<RecipeStep> returnList = new ArrayList<RecipeStep>();
for(RecipeStep step: steps)
{
    returnList.add(step);
}
return returnList;
    }













As an Amazon Associate I earn from qualifying purchases.

3 comments:

  1. How did you discover this & do you have any idea why this generates this exception?

    ReplyDelete
  2. Thanks, that saved me tearing my hair out.
    Instead of the returnList.adds, just using returnList.addAll(steps);
    works fine as well.
    Cheers
    Keith Marsh

    ReplyDelete
  3. Thanks a lot but this problem is simply terrible!

    ReplyDelete

Please be polite.

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Posts

Most Popular Articles