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.
November 29th, 2008 at 5:01 pm
You saved my brain. Wasted 3 hours on this one. You make me suck less.
December 8th, 2008 at 7:04 am
thank you so much!
December 19th, 2008 at 6:09 am
You helps me a lot. Tank you!
December 28th, 2008 at 8:54 am
It does help me a lot, thanks, bro
January 6th, 2009 at 11:48 pm
Thanks !
Thanks !
Thanks !
January 19th, 2009 at 10:43 pm
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.
January 25th, 2009 at 6:36 pm
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
February 19th, 2009 at 5:57 am
thanks a lot!! you solved my problem!!
February 27th, 2009 at 2:38 am
Thank you so much !
March 4th, 2009 at 11:50 am
Yes! Thank you!
March 9th, 2009 at 2:07 pm
Holyjeez,
I love it when its something simple!
thanks
thanks
thanks
March 26th, 2009 at 2:22 pm
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.
April 2nd, 2009 at 5:06 am
You saved my day, thanks a million!!!!
April 10th, 2009 at 10:53 am
Man!!!! You are spot on! Thanks!!!
April 15th, 2009 at 10:59 am
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.
May 27th, 2009 at 9:33 am
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.
May 28th, 2009 at 6:38 am
Thanks for this… I was missed default constructor but spent only 5 minutes in net and find yours solution.
June 5th, 2009 at 10:29 am
Thanks! I’m sure this one would have bit me in the butt for many hours if I didn’t find your post!!
June 9th, 2009 at 4:59 am
Thanks a lot.
June 16th, 2009 at 11:26 pm
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
June 17th, 2009 at 8:25 pm
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
June 17th, 2009 at 8:26 pm
Sorry I lost the mapping file :
June 17th, 2009 at 8:30 pm
[sourcecode]
[/sourcecode]
June 17th, 2009 at 8:31 pm
<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>
June 17th, 2009 at 8:35 pm
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>
June 18th, 2009 at 3:32 am
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..
July 11th, 2009 at 5:20 am
Thanks to you..
It solved all my problems
August 23rd, 2009 at 4:21 pm
Thanks a lot, You’ve solved my problem.
September 7th, 2009 at 4:57 pm
“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.
October 2nd, 2009 at 9:05 am
Dude, Thanks a lot for sharing this.
October 14th, 2009 at 7:48 am
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.
January 8th, 2010 at 6:30 am
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)
January 8th, 2010 at 6:39 am
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;
}
February 8th, 2010 at 5:38 am
Thank you! took me 5 hours to find this.
February 10th, 2010 at 8:09 am
Thank you so much !
February 19th, 2010 at 5:21 pm
Muchas gracias
April 9th, 2010 at 5:51 am
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.
April 16th, 2010 at 4:22 am
Thanks!!! I thought I have to die… THANKS!!!
July 19th, 2010 at 6:01 pm
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.
August 24th, 2010 at 1:07 am
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:
August 24th, 2010 at 1:07 am
September 7th, 2010 at 2:23 pm
THAAAAAAAAAAAAAANKS A LOT!
October 8th, 2010 at 4:07 pm
This is pretty obvious if you know what you’re doing. All serializable objects need to have a default constructor. How else do you think the object is going to be constructed upon deserialization?
However… I still have this problem despite
a) having a default constructor
b) adding the type as a subtype to an object used in a dummy GWT remote method.
This GWT error completely sucks and whoever wrote it should be fired, and then shot. Who writes an error that says… oooh it could be this, or it could be this… may as well say “Error: Something is wrong. Figure it out yourself!”.
I’d love to slap that google engineer around a bit.
October 29th, 2010 at 6:41 pm
Priceless!
November 8th, 2010 at 9:00 am
In fact, the default constructor should be public. It does not work if you just put a default constructor with package visibility.
Anyway, thanks alot!
December 9th, 2010 at 4:49 am
Hi, any1 could help me here? i did what u said, adding a default constructor, but it doesnt work =( i need to submit my project next week…any1 please?
ERROR
SEVERE: WebModule[/WebApplication2]Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method ‘public abstract java.util.ArrayList org.yournamehere.client.sampleservice.GWTService.myMethod()’ threw an unexpected exception: java.lang.NullPointerException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NullPointerException
at org.yournamehere.client.sampleservice.CallMain.setCallee(CallMain.java:50)
at org.yournamehere.server.sampleservice.GWTServiceImpl.myMethod(GWTServiceImpl.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
… 29 more
INFO: Loading application WebApplication2 at /WebApplication2
INFO: WebApplication2 was successfully deployed in 2,879 milliseconds.
SEVERE: WebModule[/WebApplication2]Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method ‘public abstract java.util.ArrayList org.yournamehere.client.sampleservice.GWTService.myMethod()’ threw an unexpected exception: java.lang.NullPointerException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NullPointerException
at org.yournamehere.client.sampleservice.CallMain.setCallee(CallMain.java:50)
at org.yournamehere.server.sampleservice.GWTServiceImpl.myMethod(GWTServiceImpl.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
… 29 more
and this is my CallMain.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.yournamehere.client.sampleservice;
import java.io.Serializable;
import java.util.*;
//import com.google.gwt.dev.util.collect.HashMap;
//import com.google.gwt.user.client.rpc.IsSerializable;
/**
*
* @author sc.wong
*/
public class CallMain implements Serializable {
public HashMap CallInfo;
/**
* HashMap that will always contain strings for both keys and values
* @gwt.typeArgs
*/
//default constructor
public CallMain(){
CallInfo = new HashMap();
CallInfo.put(”Callee”,”");
CallInfo.put(”Caller”,”");
CallInfo.put(”Call_ID”,”");
CallInfo.put(”Method”,”");
CallInfo.put(”Time”, “”);
}
/*method used to set call_id
* @param name call_id
*/
public void setCall_ID(String call_id){
CallInfo.put(”Call_ID”,call_id);
}
/*method used to set callee
* @param name callee
*/
public void setCallee(String callee){
CallInfo.put(”Callee”,callee);
}
/*method used to set celler
* @param name callee
*/
public void setCaller(String caller){
CallInfo.put(”Caller”,caller);
}
/*method used to set method
* @param name method
*/
public void setMethod(String method){
CallInfo.put(”Method”,method);
}
/*method used to set time
* @param name time
*/
public void setTime(String time){
CallInfo.put(”Time”,time);
}
/**
* Method used to get Call_ID
* @return Call_ID
*/
public String getCall_ID() {
return (String) CallInfo.get(”Call_ID”);
}
/**
* Method used to get Caller
* @return Caller
*/
public String getCaller() {
return (String) CallInfo.get(”Caller”);
}
/**
* Method used to get Callee
* @return Callee
*/
public String getCallee() {
return (String) CallInfo.get(”Callee”);
}
/**
* Method used to get Method
* @return Method
*/
public String getMethod() {
return (String) CallInfo.get(”Method”);
}
/**
* Method used to get Time
* @return Time
*/
public String getTime() {
return (String) CallInfo.get(”Time”);
}
}
THANKS A LOT!
February 4th, 2011 at 3:20 pm
Thanks this issue has been driving me mad… super informative error message that one! Grrrrr
February 24th, 2011 at 1:55 pm
Thanks a ton!!! Nice troubleshooting.
April 12th, 2011 at 4:57 am
Thanks man. You saved me from a headache.
April 13th, 2011 at 8:43 am
That’s a great hint. I would have never thought of that. Thanks a lot.
By the way: it works (for me) even with a private default constructor, so you don’t expose any unwanted functionality.
April 26th, 2011 at 9:15 am
Thanks! it worked for me !
May 6th, 2011 at 9:24 am
mann thanks so much!!
May 22nd, 2011 at 10:56 am
Thanks! Helped!
June 3rd, 2011 at 4:40 am
IOU
Thanks a million!
June 24th, 2011 at 6:15 am
Same error with inner class … sigh!
August 8th, 2011 at 6:55 am
thank you a lot!
August 10th, 2011 at 7:45 am
thanks very much for posting this — the title alone saved me!!
August 17th, 2011 at 5:25 am
The Exception: com.google.gwt.user.client.rpc.SerializationException: Type ‘com.apple.business.object.fantasysport.Event’ 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.apple.business.object.fantasysport.Event@79efa
Constructor:
public Event() {
}
But still not …….
September 1st, 2011 at 10:33 am
Thank you SO MUCH!!!! You saved my weekend! :))
September 1st, 2011 at 10:58 am
Thanks a lot for the tip. i totally missed the empty constructor part.
September 5th, 2011 at 2:26 am
Thanks a lot
September 15th, 2011 at 1:06 pm
Thx, that error message is just plain evil. I wouldn’t want to pay the dev hours wasted on that one…
October 25th, 2011 at 3:25 pm
You really helped me. Thank you!! you rock!
December 8th, 2011 at 7:44 am
Thanks, bro, you are.
)))
Crazy exception which does not tell us “TDO should implements Serializable”
January 3rd, 2012 at 2:34 pm
every once in a while i get this and find myself back at this blog trying to remember how i fixed it last time - hello to me if i’m back again - but another cause of this is having any fields declared as final in your Serializable - so make sure you don’t use final in your DTOs - GWT bug: http://code.google.com/p/google-web-toolkit/issues/detail?id=1054
January 29th, 2012 at 7:02 am
Great.
Didn’t see anything about default constructor in docs.
Google documentation lacks a lot of info.
thanks
January 31st, 2012 at 9:17 am
Thanks to Benjamin’s last comment there - GWT also can’t cope with anything that hasn’t been initialised, so make sure you’ve set you values to something - or null.