GWT Serialization Error (Missing Default Constructor)

Ever seen this error:
com.google.gwt.user.client.rpc.SerializationException: Type ‘your.class.Type’ 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.

Or this error:
Error: Type ‘your.class.Type’ was not serializable and has no concrete serializable subtypes

It can be caused by multiple reasons, but if you feel like you have done everything correctly (included source in GWT’s classpath during compilation, implement Serializable, google searched, prayed to the god of your choice) then you probably have the problem I had.  your.class.Type doesn’t have a default constructor.

So if your class has no default constructor (one that takes no arguments), add it and try again.  If that doesn’t fix it, and you find out what else is wrong, please post it as a comment here.

Also as an added bonus tip, when google searching for errors, your error usually is of the pattern: “something common to all errors of this type” “something specific to my project” “some more common stuff”.  Like in this error you have common stuff:
com.google.gwt.user.client.rpc.SerializationException: Type

Then specific stuff: 
‘your.class.Type’

Then more common stuff:
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.

The way to search for that is take your stuff and replace it with an asterisk (*) and put the whole thing in quotes and google will wildcard your specific stuff and you will get better results.  So a good way to search for this error would be (trimming because google only lets you search 32 words):
com.google.gwt.user.client.rpc.SerializationException: Type * was not included in the set of types which can be serialized by this SerializationPolicy”

Hope either of those things help someone.

 

41 Responses

  1. gwt dork Says:

    You saved my brain. Wasted 3 hours on this one. You make me suck less.

  2. fred Says:

    thank you so much!

  3. Milan Says:

    You helps me a lot. Tank you!

  4. Sammy Says:

    It does help me a lot, thanks, bro :)

  5. tan lei Says:

    Thanks !
    Thanks !
    Thanks !

  6. Cristian Says:

    Brother:

    I nonchalantly ignored the default constructor in the GXT examples I was browsing. I thought Darrell [Meyers] was just not knowing OO programming when he provided a default constructor for his class derived from BaseModelData.

    Moreover, when I saw the above error during compilation, and subsequently, my RPC answers weren’t received on the client side, the last thing in my mind was the default constructor.

    A long story short, I bow to you, Mr.

  7. Devin Says:

    Here’s another variant that’s only obvious in hindsight:

    GWT and non-GWT code exist in the same (eclipse) project in the same source tree. The GWT compiler reported problems with serialization of an interface (call it Schnib) that extends serializable. The only class that implemented this interface was a serializable POJO (call it SchnibImpl).

    Since the browser never (explicitly) created any of SchnibImpl objects, use of that class never showed up in the GWT part of the source tree; the GWT-visible code only referenced the Schnib interface. SchnibImpl itself existed outside of the part of the source tree that the GWT compiler was looking at.

    Adding in SchnibImpl to the path in the GWT xml file fixed it.

    *sigh*

    For the record, the GWT code continues to reference Schnib, not SchibImpl

  8. mattia Says:

    thanks a lot!! you solved my problem!! :)

  9. Cédric Says:

    Thank you so much !

  10. Thor Says:

    Yes! Thank you!

  11. akbrant Says:

    Holyjeez,

    I love it when its something simple!

    thanks
    thanks
    thanks

  12. Brian E Says:

    I have also found this error working with abstract classes. It appears that each subclass must also have null constructors. This is really confusing since the error only references the abstract class, not the subclasses.

  13. Muddasser Alam Says:

    You saved my day, thanks a million!!!!

  14. Rama Says:

    Man!!!! You are spot on! Thanks!!!

  15. Antoni Says:

    Even while doing all that you said, sometimes GWT still complains. Something that has helped me is to declare a private, unused variable of the type that GWT doesn’t want to Serialize, e.g.

    @SuppressWarnings(”unused”)
    private IssueClass _1;

    I put that declaration in any other GWT-serialized class.

  16. Andre Says:

    Had the same problem and spent almost a day to figure it out :-(
    A lot of details in GWT is not very logical and not very well documented.

    This issue I think “OK, it works by adding this default constructor, but WHY? Whats the logic behind it”.

    Guess there is some introspection code that assumes this, but by the error messages given is hard to figure this out.

    Tried to look at the full stacktrace in my case but there was no clue about any missing constructor.

  17. Koziołek Says:

    Thanks for this… I was missed default constructor but spent only 5 minutes in net and find yours solution.

  18. Chris Says:

    Thanks! I’m sure this one would have bit me in the butt for many hours if I didn’t find your post!!

  19. Nilesh Says:

    Thanks a lot.

  20. retha pasalli Says:

    Hi,

    I have checked my class and there has been a default constructor there but I still meet the same error. Can you help me? Thx

  21. retha pasalli Says:

    Hi holyjeez,

    sorry I didn’t put my error on my post before..

    Here is the error :
    Jun 18, 2009 8:18:06 AM org.apache.catalina.core.ApplicationContext log
    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.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    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(Thread.java:619)
    Caused by: java.lang.reflect.InvocationTargetException
    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)
    … 27 more
    Caused by: com.google.gwt.user.client.rpc.SerializationException: Type ‘com.wii.integra.domain.ProgramStudi$$EnhancerByCGLIB$$52642e86′ 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.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.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:636)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:666)
    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.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:43)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:36)
    … 32 more

    And this is my ProgramStudi Serializable class :
    public class ProgramStudi implements IsSerializable {
    private static final long serialVersionUID = -1875269016855188318L;
    private long id;
    private String nama;
    private Fakultas fakultas;
    private String keterangan;

    public ProgramStudi(){}

    /**
    * @return the id
    */
    public long getId() {
    return id;
    }

    /**
    * @param id the id to set
    */
    public void setId(long id) {
    this.id = id;
    }

    /**
    * @return the nama
    */
    public String getNama() {
    return nama;
    }

    /**
    * @param nama the nama to set
    */
    public void setNama(String nama) {
    this.nama = nama;
    }

    /**
    * @return the fakultas
    */
    public Fakultas getFakultas() {
    return fakultas;
    }

    /**
    * @param fakultas the fakultas to set
    */
    public void setFakultas(Fakultas fakultas) {
    this.fakultas = fakultas;
    }

    /**
    * @return the keterangan
    */
    public String getKeterangan() {
    return keterangan;
    }

    /**
    * @param keterangan the keterangan to set
    */
    public void setKeterangan(String keterangan) {
    this.keterangan = keterangan;
    }

    public boolean equals(Object obj)
    {
    if ((obj == null) ||
    (obj instanceof ProgramStudi == false))
    {
    return false;
    }
    else if (this == obj)
    {
    return true;
    }

    // ID comparison
    ProgramStudi progdi = (ProgramStudi) obj;
    return (id == progdi.getId());
    }

    And this is the mapping file (if it’s neccesary) :

    Thx before…
    Regards,
    Retha

  22. retha pasalli Says:

    Sorry I lost the mapping file :

  23. retha pasalli Says:

    [sourcecode]

    [/sourcecode]

  24. retha pasalli Says:

    <hibernate-mapping>
    <class name=”com.wii.integra.domain.Provinsi” table=”PROVINSI”>
    <id column=”PROVINSI_ID” name=”id”>
    <generator class=”native”/>
    </id>
    <property column=”NAMA” length=”150″ name=”nama” type=”string”/>
    <property column=”KETERANGAN” length=”200″ name=”keterangan” type=”string”/>
    </class>
    </hibernate-mapping>

  25. retha pasalli Says:

    kyaaaaa…sorry i put the wrong mapping file (I feel so stupid!!). Here is the right one :

    <hibernate-mapping>
    <class name=”com.wii.integra.domain.ProgramStudi” table=”PROGDI”>
    <id column=”PROGDI_ID” name=”id”>
    <generator class=”native”/>
    </id>
    <property column=”NAMA” length=”200″ name=”nama” type=”string”/>
    <property column=”KETERANGAN” length=”200″ name=”keterangan” type=”string”/>
    <many-to-one class=”com.wii.integra.domain.Fakultas” column=”FAKULTAS_ID” name=”fakultas”/>
    </class>
    </hibernate-mapping>

  26. retha pasalli Says:

    Hi…

    I just find the main problem..

    I added my HQL from this one :
    hqlQuery.append(”from CalonMahasiswa calon”);

    into :

    hqlQuery.append(”from CalonMahasiswa calon”); hqlQuery.append(” left join fetch calon.progdiPilihan progdi left join fetch progdi.fakultas”); hqlQuery.append(” left join fetch calon.provinsi”); hqlQuery.append(” left join fetch calon.kabKota”); hqlQuery.append(” left join fetch calon.tahunAjar”);

    And it works! Thanks for you who paid any attention or even replying my post..

  27. bugyboo Says:

    Thanks to you..

    It solved all my problems :)

  28. Anhtuan Says:

    Thanks a lot, You’ve solved my problem. :D

  29. William Says:

    “Have you added the default constructor” they say. “But of course I ha…, waaaaait a minute…”

    Sigh…

    I should probably just hand in my keyboard before I do any more harm.

    Thanks man.

  30. Anuj Says:

    Dude, Thanks a lot for sharing this.

  31. Odeen Says:

    Thanks, I can’t help myself and started to laugth reading that of “if you belived you’ve done everything you can…. ”

    Thanks, it works for me, I forgot (once again, damm alzheimer) to create a default constructor.

  32. 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;
    }
    }

    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)

  33. John Says:

    Additional info:

    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;
    }

  34. Kevin Says:

    Thank you! took me 5 hours to find this.

  35. lnr Says:

    Thank you so much !

  36. Ian Says:

    Muchas gracias

  37. amn Says:

    So my issue was not one of the above, but it was equally hard to diagnose. I have a class variable of type object as in:

    private Object myVariable;

    Apparently, GWT serialization does not like this, for the obvious reason that Object does not implement Serializable.

  38. Jogilein Says:

    Thanks!!! I thought I have to die… THANKS!!!

  39. An annoyed programmer Says:

    It bugs me when projects are this nit-picky. Why can’t this be done for me, or at least I be told of this somewhere? Either way, your solution worked, thanks.

  40. Chandan Says:

    I had the similar kind of problem, where I was returning a list of DTO objects.
    After adding the no-args constructor also, the same issue appeared.
    And after few investigation, I found a mistake, I had done in the code. If you are facing the same issue, please check whether you have added the DTO’s package in your .gwt.xml file.
    Something like this:

  41. Chandan Says:

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.