trouble with serialization of hibernate POJO with hibernate4gwt

371 views
Skip to first unread message

sharath

unread,
Sep 14, 2007, 3:25:43 PM9/14/07
to Google Web Toolkit
Hi all,

I am building a small web application using GWT, hibernate and
hibernate4gwt (to handle serialization of hibernate collections).I get
an exception when I try to retrieve domain objects from the database
by making a client-side call to the service.Here is the exception
stack trace:

StandardContext[]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:
424)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
384)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
333)
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.RPCCopy.encodeResponse(RPCCopy.java:
670)
at
com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(RPCCopy.java:
447)
at
net.sf.hibernate4gwt.gwt.HibernateRemoteService.processCall(HibernateRemoteService.java:
210)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
252)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:
198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
799)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
577)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:683)
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:
409)
... 36 more
Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
'org.hibernate.collection.PersistentSet' was not included in the set
of types which can be serialized by this SerializationPolicy. For
security purposes, this type will not be serialized.
at
com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java:
79)
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.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:
357)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
390)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
333)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
81)
at
com.google.gwt.user.client.rpc.core.java.lang.Object_Array_CustomFieldSerializer.serialize(Object_Array_CustomFieldSerializer.java:
39)
... 41 more


I am using GWT version 1.4.60 and hibernate4gwt-0.5_GWT-1.4.

I have also made my service class extend HibernateRemoteService as
required by hibernate4gwt.

Here is the domain object I am trying to retrieve from the
server."nounFormMeaning" is the field which will contain string
objects.

public class Word extends LazyGwtPojo{
private int id;
/**
* @gwt.typeArgs <java.lang.String>
*/
private Set nounFormMeaning;

.......
........
/**
* @gwt.typeArgs <java.lang.String>
*/

public Set getNounFormMeaning() {
return nounFormMeaning;
}
/**
* @gwt.typeArgs nounFormMeaning <java.lang.String>
*/

public void setNounFormMeaning(Set nounFormMeaning) {
this.nounFormMeaning = nounFormMeaning;
}
}

Does anybody know why this happens?

noon

unread,
Sep 21, 2007, 5:13:07 PM9/21/07
to Google Web Toolkit
Sorry, I missed your post.
Do you have solved your problem ?

Regards
Bruno

ryan

unread,
Sep 28, 2007, 12:17:45 PM9/28/07
to Google Web Toolkit
I'm having the same problem. Somehow GWT complains about Hibernate's
serialization.

Chinmay Bajikar

unread,
Sep 28, 2007, 12:46:33 PM9/28/07
to Google-We...@googlegroups.com
Hi,
 
I dont know much about hibernate4gwt, but this happens when hibernate lazy loads an object.
So the actual POJO which we want isnt created yet, but what is created is a dummy of that pojo.
We have isSerializable implemented for the POJO, but this dummy object (or the placeholder) object isnt implementing isSeriazable, which causes this exception,
Since we are trying to pass this non serializable object via the gwt RPC to the client.
 
One way (and a not so efficient one) is to have lazy=false for your hbm definitions
of your pojo's.
This wont load the objects lazily.
 
Thanks,
Chinmay

 
> >         at javax.servlet.http.HttpServlet.service (HttpServlet.java:709)
> > org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:

> > 137)
> >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
> > 104)
> >         at
> > org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
> > 118)
> >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
> > 102)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:
> > 520)
> >         at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
> > 109)
> >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext (StandardValveContext.java:
> > 104)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> > 520)
> >         at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java:

> > 929)
> >         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
> > 160)
> >         at
> > org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:
> > 799)
> >         at org.apache.coyote.http11.Http11Protocol
> > $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> >         at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
> > 577)
> >         at org.apache.tomcat.util.threads.ThreadPool
> > $ControlRunnable.run(ThreadPool.java:683)
> >         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)
> >          * @ gwt.typeArgs <java.lang.String>

noon

unread,
Sep 28, 2007, 1:25:05 PM9/28/07
to Google Web Toolkit
@Chinmay : hibernate4gwt was primarly made to handle properly
Hibernate proxy. It clones the Hibernate POJO to a new instance of the
same class (which implements IsSerialzable), remove the lazy
properties (marking and replicating them with null) and rely on
beanLib to convert collections (such as PersistentSet) to the base
Java implementation (a HashSet for example).

@brian : I will try to reproduce your issue with a simple JUnit test.
Stay tuned :-)

Bruno

On 28 sep, 18:46, "Chinmay Bajikar" <chin...@gmail.com> wrote:
> Hi,
>
> I dont know much about hibernate4gwt, but this happens when hibernate lazy
> loads an object.
> So the actual POJO which we want isnt created yet, but what is created is a
> dummy of that pojo.
> We have isSerializable implemented for the POJO, but this dummy object (or
> the placeholder) object isnt implementing isSeriazable, which causes this
> exception,
> Since we are trying to pass this non serializable object via the gwt RPC to
> the client.
>
> One way (and a not so efficient one) is to have lazy=false for your hbm
> definitions
> of your pojo's.
> This wont load the objects lazily.
>
> Thanks,
> Chinmay
>

> > > > 81)
> > > > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue
> > (ServerSerializationStreamWriter.java:
> > > > 259)

> > > > at com.google.gwt.user.server.rpc.RPCCopy.encodeResponse(
> > RPCCopy.java:
> > > > 670)
> > > > at
> > > > com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(


> > RPCCopy.java:
> > > > 447)
> > > > at
> > > > net.sf.hibernate4gwt.gwt.HibernateRemoteService.processCall(
> > HibernateRemoteService.java:
> > > > 210)
> > > > at
> > > > com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(
> > RemoteServiceServlet.java:
> > > > 187)

> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java


> > :709)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java
> > :802)
> > > > at
> > > > com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
> > > > 252)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java
> > :802)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:
> > > > 237)
> > > > at
> > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:
> > > > 157)
> > > > at
> > > > org.apache.catalina.core.StandardWrapperValve.invoke(
> > StandardWrapperValve.java:
> > > > 214)
> > > > at

> > > > org.apache.catalina.core.StandardValveContext.invokeNext(
> > StandardValveContext.java:
> > > > 104)
> > > > at
> > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> > :
> > > > 520)
> > > > at

> > > > org.apache.catalina.core.StandardContextValve.invokeInternal(
> > StandardContextValve.java:
> > > > 198)
> > > > at
> > > > org.apache.catalina.core.StandardContextValve.invoke(

> > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> > :
> > > > 520)
> > > > at
> > > > org.apache.catalina.core.StandardEngineValve.invoke(


> > StandardEngineValve.java:
> > > > 109)
> > > > at
> > > > org.apache.catalina.core.StandardValveContext.invokeNext(
> > StandardValveContext.java:
> > > > 104)
> > > > at
> > > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
> > :
> > > > 520)
> > > > at org.apache.catalina.core.ContainerBase.invoke(
> > ContainerBase.java:
> > > > 929)
> > > > at org.apache.coyote.tomcat5.CoyoteAdapter.service(
> > CoyoteAdapter.java:
> > > > 160)
> > > > at

> > > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:


> > > > 799)
> > > > at org.apache.coyote.http11.Http11Protocol
> > > > $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> > > > at
> > > > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
> > > > 577)
> > > > at org.apache.tomcat.util.threads.ThreadPool
> > > > $ControlRunnable.run(ThreadPool.java:683)
> > > > 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)

> > > > * @gwt.typeArgs <java.lang.String>

noon

unread,
Sep 28, 2007, 1:46:38 PM9/28/07
to Google Web Toolkit
Hello again,

I have checked my sample application (that helps me to test every
release), and my POJO looks like yours (having a Set member).
I am pretty confused. Can you post some more code (POJO loading code,
GWT remote service,...)

Regards
Bruno

> ...
>
> plus de détails »

ryan

unread,
Oct 1, 2007, 3:17:51 PM10/1/07
to Google Web Toolkit
Hi,
I'm using hibernate4gwt and followed the exact instructions. However,
I received this exception everytime I did an RPC. In debug mode, the
server managed to retrieve and return the correct values from the
database.

Exception:
Storing object as
java.util...@net.sf.hibernate4gwt.exception.NotHibernateObjectException
com.google.gwt.user.client.rpc.InvocationException: The call failed on
the server; see server log for details
at com.radianta.client.services.DataProvider_Proxy
$1.onCompletionImpl(transient source for
com.radianta.client.services.DataProvider_Proxy:60)
at com.radianta.client.services.DataProvider_Proxy
$1.onCompletionAndCatch(transient source for
com.radianta.client.services.DataProvider_Proxy:44)
at com.radianta.client.services.DataProvider_Proxy
$1.onCompletion(transient source for
com.radianta.client.services.DataProvider_Proxy:38)


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.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
126)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:
150)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
293)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:
196)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:
117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:689)
at com.google.gwt.dev.GWTShell.run(GWTShell.java:550)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:321)


Server Implementation:
public List getCyberDataDevices() {
try
{
CyberDataDeviceDAO cyberDataDeviceDAO = new
CyberDataDeviceDAO(rsf);
List devices = cyberDataDeviceDAO.GetDevices();
rsf = new DefaultRadiantaSessionFactory(dbhost, dbname, dbusername,
dbpassword);
sf = rsf.currentSession().getSessionFactory();
HibernateLazyManager.getInstance().setPojoStore(new
HttpSessionPojoStore());
HibernateLazyManager.getInstance().setSessionFactory(sf);
return devices;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}


Client proxy:
public interface DataProviderAsync {
public void getCyberDataDevices(AsyncCallback callback);
}

public interface DataProvider extends RemoteService {
public List getCyberDataDevices();
}


Client UI:
public void onSuccess(Object result) {
resultData = (ArrayList)result;
CyberDataDevice button = (CyberDataDevice)resultData.get(row);
Hyperlink linkDelete = new Hyperlink("Delete",
button.getFriendlyName());
}


Finally, the POJO:
public class CyberDataDevice implements IsSerializable
{

// Fields

private int deviceId;

private Department department;

private String deviceName;

private String ipAddress;

private String friendlyName;

private Set cyberdatadeviceactionses = new HashSet(
0);

// Constructors

/** default constructor */
public CyberDataDevice()
{
}

/** minimal constructor */
public CyberDataDevice(int deviceId, String friendlyName)
{
this.deviceId = deviceId;
this.friendlyName = friendlyName;
}

/** full constructor */
public CyberDataDevice(int deviceId, Department department,
String deviceName, String ipAddress, String friendlyName,
Set cyberdatadeviceactionses)
{
this.deviceId = deviceId;
this.department = department;
this.deviceName = deviceName;
this.ipAddress = ipAddress;
this.friendlyName = friendlyName;
this.cyberdatadeviceactionses = cyberdatadeviceactionses;
}

// Property accessors
public int getDeviceId()
{
return this.deviceId;
}

public void setDeviceId(int deviceId)
{
this.deviceId = deviceId;
}

public Department getDepartment()
{
return this.department;
}

public void setDepartment(Department department)
{
this.department = department;
}

public String getDeviceName()
{
return this.deviceName;
}

public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}

public String getIpAddress()
{
return this.ipAddress;
}

public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}

public String getFriendlyName()
{
return this.friendlyName;
}

public void setFriendlyName(String friendlyName)
{
this.friendlyName = friendlyName;
}

public Set getCyberdatadeviceactionses()
{
return this.cyberdatadeviceactionses;
}

public void setCyberdatadeviceactionses(
Set cyberdatadeviceactionses)
{
this.cyberdatadeviceactionses = cyberdatadeviceactionses;
}

}


On Sep 28, 10:46 am, noon <bruno.marches...@gmail.com> wrote:
> Hello again,
>
> I have checked my sample application (that helps me to test every
> release), and my POJO looks like yours (having a Set member).
> I am pretty confused. Can you post some more code (POJO loading code,
> GWT remote service,...)
>
> Regards
> Bruno
>
> On 28 sep, 19:25, noon <bruno.marches...@gmail.com> wrote:
>

> > @Chinmay :hibernate4gwtwas primarly made to handle properly


> > Hibernate proxy. It clones the Hibernate POJO to a new instance of the
> > same class (which implements IsSerialzable), remove the lazy
> > properties (marking and replicating them with null) and rely on
> > beanLib to convert collections (such as PersistentSet) to the base
> > Java implementation (a HashSet for example).
>
> > @brian : I will try to reproduce your issue with a simple JUnit test.
> > Stay tuned :-)
>
> > Bruno
>
> > On 28 sep, 18:46, "Chinmay Bajikar" <chin...@gmail.com> wrote:
>
> > > Hi,
>

> > > I dont know much abouthibernate4gwt, but this happens when hibernate lazy

> > > > > >hibernate4gwt(to handle serialization of hibernate collections).I get

> ...
>
> read more »

noon

unread,
Oct 1, 2007, 5:12:35 PM10/1/07
to Google Web Toolkit
Hello Ryan,

Two comments about the code you posted :
- The HibernateLazyManager initialization code should be set in the
constructor (or the init method) of your classe, since it is needed
*before* and after the call of your remote service method.
- Furthermore, the "Storing object as
java.util.ArrayL...@net.sf.hibernate4gwt.exception.NotHibernateObjectException"
is symptomatic of a bug I corrected last week and that happens only in
stateful mode. Can you please switch to stateless mode (by just make
your Domain class inherits from LazyGwtPojo) to see if everything run
ok ?

For information, I am currently working on release 1.0 and it will
probably be out this month.

Regards
Bruno

On 1 oct, 21:17, ryan <ryan.sa...@gmail.com> wrote:
> Hi,
> I'm using hibernate4gwt and followed the exact instructions. However,
> I received this exception everytime I did an RPC. In debug mode, the
> server managed to retrieve and return the correct values from the
> database.
>
> Exception:
> Storing object as

> java.util.ArrayL...@net.sf.hibernate4gwt.exception.NotHibernateObjectException

ryan

unread,
Oct 1, 2007, 6:32:09 PM10/1/07
to Google Web Toolkit
Hi,
I did some changes according to your instructions. However, I received
different exception this time. Am I doing something terribly wrong
here? Thx for your help.

Stack in Eclipse:


Stack in GWT hosted mode console:
[WARN] StandardContext[]Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
java.lang.reflect.InvocationTargetException
at

Caused by: java.lang.reflect.InvocationTargetException: null
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:
409)


at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
384)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:

333)
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.RPCCopy.encodeResponse(RPCCopy.java:
670)
at
com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(RPCCopy.java:
447)
at
net.sf.hibernate4gwt.gwt.HibernateRemoteService.processCall(HibernateRemoteService.java:
210)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
'com.radianta.cuae.datalayer.beans.CyberDataDevice' was not included


in the set of types which can be serialized by this
SerializationPolicy. For security purposes, this type will not be
serialized.
at
com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java:

79)
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.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:
46)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer(ServerSerializationStreamWriter.java:
409)


at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
384)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:

333)
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.RPCCopy.encodeResponse(RPCCopy.java:
670)


Server implementation:
public DataProviderImpl()
{


rsf = new DefaultRadiantaSessionFactory(dbhost, dbname, dbusername,
dbpassword);
sf = rsf.currentSession().getSessionFactory();

HibernateLazyManager.getInstance().setSessionFactory(sf);
}

public List getCyberDataDevices() {
try
{
CyberDataDeviceDAO cyberDataDeviceDAO = new
CyberDataDeviceDAO(rsf);
List devices = cyberDataDeviceDAO.GetDevices();

return devices;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}


POJO
public class CyberDataDevice extends LazyGwtPojo
{

// Fields

private int deviceId;

private Department department;

private String deviceName;

private String ipAddress;

private String friendlyName;

/**
* @gwt.typeArgs <com.radianta.domain.Cyberdatadeviceactions>
*/

// Constructors

}

> > I'm usinghibernate4gwtand followed the exact instructions. However,

> ...
>
> read more »

Miguel Méndez

unread,
Oct 1, 2007, 9:43:17 PM10/1/07
to Google-We...@googlegroups.com
Looks like com.radianta.cuae.datalayer.beans.CyberDataDevice was not considered to be serializable.  This can happen if the declaration of List getCyberDataDevices() does not have a @gwt.typeArgs annotation.  It can also happen if the CyberDataService class is not considered to be part of the client-side code.  See the source path section of http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Fundamentals.Modules.html for more details on client-side code/translatable source.

        at org.eclipse.swt.internal.win32.OS.DispatchMessage (OS.java:1925)
409)
        at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
384)
        at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize (ServerSerializationStreamWriter.java:
333)
        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:
> >         at com.radianta.client.services.DataProvider_Proxy
> > $1.onCompletionAndCatch(transient source for
> > com.radianta.client.services.DataProvider_Proxy:44)
> >         at com.radianta.client.services.DataProvider_Proxy
> > $1.onCompletion(transient source for
> > com.radianta.client.services.DataProvider_Proxy:38)
> >         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.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
> > 126)
> >         at
> > com.google.gwt.dev.shell.ie.IDispatchProxy.invoke (IDispatchProxy.java:
> > 150)
> >         at
> > com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
> > 293)
> >         at
> > com.google.gwt.dev.shell.ie.IDispatchImpl.method6 (IDispatchImpl.java:
> > 196)
> >         at
> > org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:
> > 117)
> >         at org.eclipse.swt.internal.win32.OS.DispatchMessageW (Native Method)

> >         at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
> >         at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
> >         at com.google.gwt.dev.GWTShell.pumpEventLoop (GWTShell.java:689)

ryan

unread,
Oct 2, 2007, 1:14:00 PM10/2/07
to Google Web Toolkit
This is what my remote service looks like:

public interface DataProvider extends RemoteService {

public boolean login(String username, String password);
/**
* @gwt.typeArgs <com.radianta.domain.CyberDataDevice>
*/
public List getCyberDataDevices();
}

As you can see, I did specify a typeArgs.
For modules, I also specified the path to the source:

<source path='domain'/>
<source path='client'/>

Therefore those two are unlikely to be the problem. For the record, I
have the hibernate part on a seperate jar file. I then copied the
beans into my 'domain' package so that the client recognizes the type.
Could it be that the server cannot / did not serialize the return
object?

On Oct 1, 6:43 pm, "Miguel Méndez" <mmen...@google.com> wrote:
> Looks like com.radianta.cuae.datalayer.beans.CyberDataDevice was not
> considered to be serializable. This can happen if the declaration of List
> getCyberDataDevices() does not have a @gwt.typeArgs annotation. It can also
> happen if the CyberDataService class is not considered to be part of the

> client-side code. See the source path section ofhttp://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...


> more details on client-side code/translatable source.
>

> > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
> > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
> > :2966)

> > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:689)
> > at com.google.gwt.dev.GWTShell.run(GWTShell.java:550)
> > at com.google.gwt.dev.GWTShell.main(GWTShell.java:321)
>
> > Stack in GWT hosted mode console:
> > [WARN] StandardContext[]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:
> > 424)
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl
> > (ServerSerializationStreamWriter.java:

> > 384)
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize
> > (ServerSerializationStreamWriter.java:
> > 333)
> > 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.RPCCopy.encodeResponse(
> > RPCCopy.java:
> > 670)
> > at
> > com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(
> > RPCCopy.java:
> > 447)
> > at
> > net.sf.hibernate4gwt.gwt.HibernateRemoteService.processCall(
> > HibernateRemoteService.java:
> > 210)
> > at
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(
> > RemoteServiceServlet.java:

> > 187)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > Caused by: java.lang.reflect.InvocationTargetException: null
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer
> > (ServerSerializationStreamWriter.java:
> > 409)
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl
> > (ServerSerializationStreamWriter.java:

> > 384)
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize
> > (ServerSerializationStreamWriter.java:
> > 333)
> > 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.RPCCopy.encodeResponse(
> > RPCCopy.java:
> > 670)
> > at
> > com.google.gwt.user.server.rpc.RPCCopy.encodeResponseForSuccess(
> > RPCCopy.java:
> > 447)
> > at
> > net.sf.hibernate4gwt.gwt.HibernateRemoteService.processCall(
> > HibernateRemoteService.java:
> > 210)
> > at
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(
> > RemoteServiceServlet.java:

> > 384)
> > at
>
> > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize
> > (ServerSerializationStreamWriter.java:
> > 333)
> > 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.RPCCopy.encodeResponse(
> > RPCCopy.java:

> ...
>
> read more »

noon

unread,
Oct 2, 2007, 4:22:51 PM10/2/07
to Google Web Toolkit
Hello Ryan,

Does your implementation DataProviderImpl also have the annotation
@gwt.typeArgs ?
You can also have a look at the hibernate4gwt sample application
(available on SVN) to compare your code to mine.

Keep the faith ;)
Bruno

ryan

unread,
Oct 2, 2007, 8:26:47 PM10/2/07
to Google Web Toolkit
It's working!! The problem was I tried to use hibernate as a seperate
jar file. Apparently gwt cannot compile the portion of jar file into
js.
Although I tried extracting just the beans into my source, Java cannot
cast from the bean type in the jar file into the bean type in the
source file.
I then extracted all source files in the hibernate's jar and added
those into my GWT project. Now it's working if I press compile on GWT
console... But it wont work on hosted mode.
Bruno, do you know anything about this?

Thx,
Ryan

> ...
>
> read more »

ryan

unread,
Oct 2, 2007, 8:34:13 PM10/2/07
to Google Web Toolkit
Edit that...
It appears that I changed gwt's version to 1.4.59. Works flawlessly in
1.4.60. Thank you for everything, looking forward to the next release.

Thx,
Ryan

> ...
>
> read more »

Reply all
Reply to author
Forward
0 new messages