If you are using GWT 1.4 and sending custom objects over the wire, and see an exception like this in your log files:


2007-11-09 11:06:13 Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.foo.common.data.User' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable'
and did not have a custom field serializer.  For security purposes, this type will not be serialized.
at com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateSerialize(LegacySerializationPolicy.java:136)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:331)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:81)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:259)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:574)
at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:442)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:530)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:265)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

You may be very interested in this release note from the 1.4.59 release:

RPC now generates a serialization policy file during compilation. The serialization policy file contains a whitelist of allowed types which may be serialized. Its name is a strong hash name followed by .gwt.rpc. This file must be deployed to your web server as a public resource, accessible from a RemoteServiceServlet via ServletContext.getResource(). If it is not deployed properly, RPC will run in 1.3.3 compatibility mode and refuse to serialize types implementing Serializable. Updated 3/6/2011 to correct link location.

This exception caused me a world of grief, first because I wasn’t seeing anything in standard out (it logged to a different file), then because I couldn’t find the source of LegacySerializationPolicy, then because I have the gwt source in one directory, but because of rewrites, it appears to be served from another directory. It manifests on the client side as an InvocationException with a fantasticly unhelpful error message.

The fix is simple: copy the serialization policy file to wherever the GWT files appear to be served from.

31 thoughts on “InvocationException using GWT RPC and custom objects

  1. Matias says:

    Good post, save a lot of time for me.

  2. David Vo says:

    Could you tell me where precisely to put this file ?

  3. moore says:

    Hi David,

    You need to put the RPC files in the path where the web server says they are being served from.

    For example, if I have a bunch of gwt code that is deployed here:
    /var/www/htdocs/mywebapp/code/gwt (where /var/www is your webroot)

    but I have a rewrite rule that strips ‘/mywebapp/code’ from all requests, so that the gwt code is accessed via this url: http://www.mysite.com/gwt/

    then I need to have the rpc files in this directory:
    /var/www/htdocs/gwt/

    This is my experience with GWT 1.4.

  4. Normand Rivard says:

    Hi David,

    I have exactly that error message, but sorry I don’t understand your fix. I do have a file named 0FF0F0328A15EBD06758726D0BAB78BF.gwt.rpc under my www directory. That file is definitely served by my server since I can see it when I type its url (ex.: https://mypc.cn.ca/ca.cn.MyGWTClient/0FF0F0328A15EBD06758726D0BAB78BF.gwt.rpc). I was expecting that file to contain a reference to my custom class, but it doesn’t, only java.lang and java.util classes.

    Do you mean there is another rpc file I need to copy to www directory? Do I have to manually edit that file to add my customer object class as Serializable or the file I have should have an entry for my custom class?

    Thx in advance
    Norm

  5. moore says:

    Hi Norm,

    The GWT compiler should generate the .rpc files automatically and add your custom classes. Are you getting any compiler warnings? Have you marked your custom objects with the ‘Serializable’ or ‘IsSerializable’ interfaces?

    The issue that I ran into (to try to explain it better) was that the URL location of the RPC was different than the filesystem location, due to some URL rewrites I was doing. The GWT-RPC classes retrieve the .rpc files via URL calls, so the .rpc files need to be where the gwt .xml/.html files *appear* to be served from. I don’t know if that applies in your case.

    Hope this helps.

  6. xmariachi says:

    Hi moore,
    thanks for the post.

    I’m having the same error apparently.

    But I’m placing the rpc files where my .html files are when deploying the .war. (Actually they appeared there automatically)

    In fact this used to work when working on a single-webapp of tomcat – now we are moving into a tomcat with many webapps, and this is causing errors.

    You seem to make a distintction on “where the files *appear* to be served”. What do you mean? I got my .rpc in the same dir where the html are.

    Good thing is that I can see the log output written to the localhost log files.

    I’m kind of crazy on this. Could you help with it?
    Thanks a lot!

  7. Normand Rivard says:

    Hi again

    Please dismiss my first question, I figured out why my rpc file was not right. I had to add a default (zero argument) constructor to my DTO and then the rpc was generated correctly (I guess), but I still have the same error when I test:
    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘ca.cn.userutil.business.product.model.ProductImpl’ was not assignable to ‘com.google.gwt.user.client.rpc.IsSerializable’ and did not have a custom field serializer. For security purposes, this type will not be serialized.

    The ProductImpl class is implementing a Product interface that only defines getters and setters. It also implements Serializable. At this point, I don’t know what I am doing wrong.

    Thx

  8. moore says:

    Hi xmariachi,

    A few questions:

    Can you send me a link to your site with the error?
    What are the urls like for both your html files and your .rpc files?
    Where is the html file that the gwt module starts up from?

  9. moore says:

    Hi Norm,

    A few questions:

    What version of GWT are you using–GWT 1.4 or later?

    Do you get any compiler error messages?

    Does ca.cn.userutil.business.product.model.ProductImpl implement java.io.Serializable (and not some other Serializable?

    Does ProductImpl have any members that are not serializable?

  10. Normand Rivard says:

    Hi Dan

    Thanks for your reply.

    I am using GWT 1.5.3. No error or warning when I compile or translate to javascript. The generated rpc file has ProductImpl in the white list.

    The only thing I noticed, that class ProductImpl is not a straightforward javabean, with only stupid getters and setters, but has some other business methods. Also, some getters don’t have a correspondent setter and vice versa and some private fields don’t have a getter. What I did yesterday is to create a brand new ProductDTO as a straightforward javabean, made that new class implements isSerializable and copy manually all values from ProductImpl to ProductDTO upon returning from the RPC service. It just worked.

    There must be something in that class that GWT didn’t like, but at this point I will move on with that and investigate later.

    Thanks for your help.
    Norm

  11. xmariachi says:

    Hi Dan,
    I’m afraid I can’t point you to the place. Restricted access at the moment.

    I’m running a tomcat with multiple webapps.
    Structure is:
    xxx.net/tomcat/webapps/domain
    and here, there are files:
    .gwt.rpc
    .cache.html

    and directories

    gwt
    WEB-INF
    META-INF

    (and some other files that I understand as not-relevant to the project)

    The fact is, I have several webapps. They all give the same error:

    INFO: WARNING: Failed to get the SerializationPolicy ‘EC6B555B4559BC7F4A0CB92EDBF33F8A’ for module ‘https://test.integration.enormo.net/’; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result.
    Jan 13, 2009 12:02:39 PM org.apache.catalina.core.ApplicationContext log
    SEVERE: Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException: Type ‘xxx.Constants’ was not assignable to ‘com.google.gwt.user.client.rpc.IsSerializable’ and did not have a custom field serializer. For security purposes, this type will not be serialized.

    But, the servlets that don’t use other than Standard java classes serialised (java.lang, java.util, etc.) work fine – it’s our custom classes that have problems.

    It also says, just before this error:

    INFO: ERROR: The module path requested, /, is not in the same web application as this servlet, /test.integration. Your module may not be properly configured or your client and server code maybe out of date.

    So I’m thinking of a context problem.

  12. xmariachi says:

    I havent solved it – but I have taken another approach: vhosting.

    By virtual hosting, apparently each application has a more defined context, and then the files can be loaded.

    I still don’t know what was happening on the earlier config though.
    I have to say that creating a ROOT folder (the default context) and then placing the files inside didnt work either. (including restart of tomcat).

    So I solved the problem indirectly, though I still havent got a clue of what was going on.

    Best

  13. moore says:

    xmariachi, Norm, glad that you both solved your problems, even if I wasn’t all that much help!

  14. Lavanya says:

    Hai,
    Iam also getting the following error:
    SEVERE: Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException:
    java.lang.reflect.InvocationTargetException
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:696)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at
    com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
    at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:573)
    at
    com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:441)
    at
    com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:529)
    at
    com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
    at
    com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:678)
    … 24 more
    Caused by: com.google.gwt.user.client.rpc.SerializationException:
    java.lang.reflect.InvocationTargetException
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:696)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at
    com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at
    com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(Map_CustomFieldSerializerBase.java:50)
    at
    com.google.gwt.user.client.rpc.core.java.util.LinkedHashMap_CustomFieldSerializer.serialize(LinkedHashMap_CustomFieldSerializer.java:48)
    … 28 more
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:678)
    … 33 more
    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
    ‘com.u4ea.gwt.client.beans.Sample’ was not assignable to
    ‘com.google.gwt.user.client.rpc.IsSerializable’ and did not have a custom field
    serializer. For security purposes, this type will not be serialized.
    at
    com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateSerialize(LegacySerializationPolicy.java:140)
    at
    com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:591)
    at
    com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at
    com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:43)
    at
    com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:36)
    … 37 more

    That too iam not getting always.Sometimes only its coming.Iam using java.io.Serializable .Can you please tell me anyway to overcome it..

    Thanks in Advance,
    Lavanya

  15. moore says:

    Hi Lavanya,

    Have you made sure that your .rpc files are where your server thinks the .cache.html files are being served from? See my comment to David on June 16, 2008.

    Also, what version of GWT are you using?

  16. Lavanya says:

    Moore,
    Thanks. The version iam using is 1.5.3.
    My .rpc files and cache.html files is present under webapps/sample.
    I used to run like http://localhost:12080/sample/.
    That too sometimes its coming i cannot find out the reason.Even sometime if i clear the cache and temp files the exception is not coming.Is there any link.Please let me know.

    Thanks in Advance,
    Lavanya

  17. Radek Jun says:

    Hi, I had exactly the same problem with ServiceDto :

    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘cz.eduspa.manager.datamodel.dto.service.ServiceDto’ was not assignable to ‘com.google.gwt.user.client.rpc.IsSerializable’ and did not have a custom field serializer. For security purposes, this type will not be serialized.
    at com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateSerialize(LegacySerializationPolicy.java:140)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:581)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:43)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:36)

    I checked implementation of Serializable, constructors and everything was find. Rebuild do nothing. After hour a tried remove browser cache and it works now again!

    So try also remove all caches!

  18. Lakshminath says:

    Hi,

    I am too getting a similar problem like was reported above
    I am trying to run application on tomcat and I have some of the DTO objects under a package com.xxxxx.xxxx and I able to get objects from table except for one DTO, I am implementing IsSerializable interface for my DTO when I watch at the the loggers in tomcat I see the following stack trace

    SEVERE: Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException: java.lang.reflect.InvocationTargetException
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:696)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
    at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:573)
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:441)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:529)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:678)
    … 24 more
    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘[Ljava.lang.Object;’ 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.
    at com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java:83)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:591)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:43)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:36)
    … 29 more

    nothing else is displayed in the loggers. while compiling my application I am shown with the following warning :

    Compiling module com.xxxx.xxxx.xxxx.EPestReporting
    Scanning for additional dependencies: file:/E:/code/xxxx/src/com/xxxx/xxxx/xxxx/xxxx/LoginScreen.java
    Computing all possible rebind results for ‘com.xxxx.xxxx.xxxx.client.HibernateService’
    Rebinding com.infronics.epest.reporting.client.HibernateService
    Invoking
    Generating client proxy for remote service interface ‘com.xxxx.xxxx.xxxx.client.HibernateService’
    Analyzing ‘com.xxxx.xxxx.xxxx.client.HibernateService’ for serializable types
    Analyzing methods:
    public abstract java.util.List getDetailedSurveyReport(java.util.HashMap hm)
    Parameter: java.util.HashMap hm
    java.util.HashMap
    Verifying instantiability
    java.util.HashMap
    [WARN] Checking all subtypes of Object which qualify for serialization
    Compiling 6 permutations
    Permutation compile succeeded
    Linking into E:\code\xxxxxxxx\war
    Link succeeded
    Compilation succeeded — 33.172s

    can any one share there idea’s regarding how to solve this problem.

    Thanks in advance.
    Lakshminath.

  19. Yogesh Mangrulkar says:

    Thanks a lot for this post. It did save a lot of time.

  20. Rafiq says:

    this is happening again in gwt 1.7.1. mine is a simple dto .

    public class DashboardContentPerCB implements java.io.Serializable {

    /**
    *
    */
    private static final long serialVersionUID = -942706244807451824L;

    private String companyID;
    private String companyName;
    private String branchID;
    private String branchName;
    private Integer isMasterYN;
    private List featureNames = new ArrayList();
    private List transactions;
    private List appShortcuts;

    public DashboardContentPerCB(){

    }

    public String getCompanyID() {
    return companyID;
    }
    public void setCompanyID(String companyID) {
    this.companyID = companyID;
    }
    public String getCompanyName() {
    return companyName;
    }
    public void setCompanyName(String companyName) {
    this.companyName = companyName;
    }
    public String getBranchID() {
    return branchID;
    }
    public void setBranchID(String branchID) {
    this.branchID = branchID;
    }
    public String getBranchName() {
    return branchName;
    }
    public void setBranchName(String branchName) {
    this.branchName = branchName;
    }
    public Integer getIsMasterYN() {
    return isMasterYN;
    }
    public void setIsMasterYN(Integer isMasterYN) {
    this.isMasterYN = isMasterYN;
    }
    public List getFeatureNames() {
    return featureNames;
    }
    public void setFeatureNames(List featureNames) {
    this.featureNames = featureNames;
    }
    public List getTransactions() {
    return transactions;
    }
    public void setTransactions(List transactions) {
    this.transactions = transactions;
    }
    public List getAppShortcuts() {
    return appShortcuts;
    }
    public void setAppShortcuts(List appShortcuts) {
    this.appShortcuts = appShortcuts;
    }
    }

  21. moore says:

    Rafiq,

    I haven’t used 1.7.1 yet, but my first question would be, what are in those lists (featureNames, appShortcuts)? Are they standard java objects, or custom ones that you’ve created?

  22. Lakshminath says:

    HI ,

    I have tried using parametrized hashmap as moore suggested , my problem got fixed and the problem is no more reproducible.
    thanks moore !!!.

  23. John says:

    I have a related problem that I havent fix yet and do not completely understand.Please help me. Below are the details:

    public class EmployeeList extends LightEntity implements IsSerializable
    {
    private static final long serialVersionUID = 1L;

    private int emp_id;
    private String firstname;
    private String lastname;
    private double total_consumption;

    public EmployeeList()
    {

    }

    public EmployeeList(int emp_id, String firstname, String lastname,
    double total_consumption)
    {
    this.emp_id = emp_id;
    this.firstname = firstname;
    this.lastname = lastname;
    this.total_consumption = total_consumption;
    }

    public int getEmpID()
    {
    return emp_id;
    }

    public void setEmpID(int emp_id)
    {
    this.emp_id = emp_id;
    }

    public String getFirstname()
    {
    return firstname;
    }

    public void setFirstname(String firstname)
    {
    this.firstname = firstname;
    }

    public String getLastname()
    {
    return lastname;
    }

    public void setLastname(String lastname)
    {
    this.lastname = lastname;
    }

    public double getTotalConsumption()
    {
    return this.total_consumption;
    }

    public void setTotalConsumption(int total_consumption)
    {
    this.total_consumption = total_consumption;
    }
    }

    In the Service Implementation class:

    @Override
    public List generateReport(String reportItem, String positionItem)
    {
    List employeeList =
    coDBManager.generateEmployeeReport(reportItem, positionItem);

    return employeeList;
    }

    In my DBManager class:

    public List generateEmployeeReport(String reportItem, String reportPosition)
    {

    Session session =
    MyHibernateUtil.getSessionFactory().getCurrentSession();

    session.beginTransaction();

    StringBuffer sql = new StringBuffer();
    sql.append(“select employee.emp_id, employee.lastname, employee.firstname, ” +
    “(select sum(itemdetails.amount) from Item item, ItemDetails itemdetails ” +
    “where item.emp_id=employee.emp_id and item.id = itemdetails.itemid) as total_consumption ” +
    “from Employee employee”);

    Query query = null;
    List result = null;

    try
    {
    query = session.createQuery(sql.toString());
    result = query.list();

    session.getTransaction().commit();
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }

    return result;
    }

    ERROR:

    [WARN] Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException: java.lang.reflect.InvocationTargetException
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:696)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponse(RPCCopy_GWT16.java:597)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponseForSuccess(RPCCopy_GWT16.java:429)
    at com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(RPCCopy.java:193)
    at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:157)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:678)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponse(RPCCopy_GWT16.java:597)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponseForSuccess(RPCCopy_GWT16.java:429)
    at com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(RPCCopy.java:193)
    at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:157)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘[Ljava.lang.Object;’ 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.
    at com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java:83)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:591)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:43)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:678)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:659)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponse(RPCCopy_GWT16.java:597)
    at com.google.gwt.user.server.rpc.RPCCopy_GWT16.encodeResponseForSuccess(RPCCopy_GWT16.java:429)
    at com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(RPCCopy.java:193)
    at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:157)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

  24. John says:

    Hi! Moore, thank you for a quick reply… Honestly, I am really new to gwt. I will double check on it. Thank you again.

  25. Mahesh Lavannis says:

    Re-compiling and re-deploying my GWT app fixed the problem for me.

  26. edinson says:

    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘entidad.Usuarios’ 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.

  27. edinson says:

    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘entidad.Usuarios’ 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.

    me puedes ayudar seria de gran ayuda para mi

  28. Serge says:

    Added a default parameterless constructor to the class and that resolved the problem. I am using the GWT2.1.0_M3

  29. shivas says:

    Hi,
    Im trying to develop a web interface for recording ontologies and I am also making client and server side communication through rpc. when i try to call a method body from server side by clicking a button in user interface im facing the below error

    SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException: Type ‘java.lang.SecurityException’ 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 = java.lang.SecurityException: Cannot resolve path E:Users\shivas\Desktop\local.owl
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:619)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:539)
    at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:616)
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:390)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:362)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)


    Please help me in resolving this.

Comments are closed.


© Moore Consulting, 2003-2017 +