gwt-sl and hibernate4gwt is not work.

56 views
Skip to first unread message

JumYom

unread,
Jul 13, 2008, 11:50:24 PM7/13/08
to gwt-sl
Hi George,
I try to integrate gwt-sl hibernate4gwt base on your example and
hibernate4gwt's example but it's not work.
http://groups.google.com/group/gwt-sl/browse_thread/thread/74f871952756c909

this is my configurations.
<!-- Message DAO -->
<bean id="messageDAO"
class="net.sf.hibernate4gwt.sample.server.dao.hibernate.MessageDAO">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- User DAO -->
<bean id="userDAO"
class="net.sf.hibernate4gwt.sample.server.dao.hibernate.UserDAO">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- Message service -->
<bean id="messageService"
class="net.sf.hibernate4gwt.sample.server.service.implementation.MessageService">
<property name="messageDAO" ref="messageDAO" />
</bean>
<!-- Identification service -->
<bean id="identificationService"
class="net.sf.hibernate4gwt.sample.server.service.implementation.IdentificationService">
<property name="userDAO" ref="userDAO" />
</bean>
<!-- Startup service -->
<bean id="startupService"
class="net.sf.hibernate4gwt.sample.server.service.implementation.StartupService">
<property name="userDAO" ref="userDAO" />
</bean>
<!-- Servlet Service -->
<bean id="messageRemote"
class="net.sf.hibernate4gwt.sample.server.gwt.MessageRemoteImpl">
<property name="messageService" ref="messageService" />
</bean>

<bean id="loginRemote"
class="net.sf.hibernate4gwt.sample.server.gwt.LoginRemoteImpl">
<property name="identifitcationService" ref="identificationService" /
>
</bean>
<bean id="userRemote"
class="net.sf.hibernate4gwt.sample.server.gwt.UserRemoteImpl">
<property name="identifitcationService" ref="identificationService" /
>
</bean>
<bean id="configurationRemote"
class="net.sf.hibernate4gwt.sample.server.gwt.ConfigurationRemoteImpl">
<property name="startupService" ref="startupService" />
</bean>

<bean id="pojoStore"
class="net.sf.hibernate4gwt.core.store.stateless.StatelessPojoStore" /
>
<bean id="classMapper"
class="net.sf.hibernate4gwt.core.beanlib.mapper.ProxyClassMapper" />
<bean id="hibernateBeanManager"
class="net.sf.hibernate4gwt.core.HibernateBeanManager">
<property name="pojoStore" ref="pojoStore" />
<!-- property name="classMapper" ref="classMapper" /> -->
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="rpcMessageRemote"
class="org.gwtwidgets.server.spring.hb4gwt.HB4GWTRPCServiceExporter">
<property name="service" ref="messageRemote" />
<property name="beanManager" ref="hibernateBeanManager" />
</bean>
<bean id="rpcLoginRemote"
class="org.gwtwidgets.server.spring.hb4gwt.HB4GWTRPCServiceExporter">
<property name="service" ref="loginRemote" />
<property name="beanManager" ref="hibernateBeanManager" />
</bean>
<bean id="rpcUserRemote"
class="org.gwtwidgets.server.spring.hb4gwt.HB4GWTRPCServiceExporter">
<property name="service" ref="userRemote" />
<property name="beanManager" ref="hibernateBeanManager" />
</bean>
<bean id="rpcConfigurationRemote"
class="org.gwtwidgets.server.spring.hb4gwt.HB4GWTRPCServiceExporter">
<property name="service" ref="configurationRemote" />
<property name="beanManager" ref="hibernateBeanManager" />
</bean>
<bean
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<map>
<entry key="/MessageRemote" value-ref="rpcMessageRemote" />
<entry key="/LoginRemote" value-ref="rpcLoginRemote" />
<entry key="/UserRemote" value-ref="rpcUserRemote" />
<entry key="/ConfigurationRemote" value-
ref="rpcConfigurationRemote" />
</map>
</property>
</bean>

this is my example service, model class

public class ConfigurationRemoteImpl /*extends
HibernateRemoteService*/ implements ConfigurationRemote {
}
// I comment HibernateRemoteService follow the gwt-sl document that
use
// HB4GWTRPCServiceExporter instead.

package net.sf.hibernate4gwt.sample.domain;
public class User implements Serializable, IsSerializable {
private static final long serialVersionUID = 1058354709157710766L;
private Integer id;
private Integer version;
private String login;
private String firstName;
private String lastName;
private String password;
/**
* @gwt.typeArgs <net.sf.hibernate4gwt.sample.domain.Message>
*/
private Set messageList;
}
package net.sf.hibernate4gwt.sample.domain;
public class Message implements Serializable, IsSerializable {
private static final long serialVersionUID = 3445339493203407152L;
private Integer id;
private Integer version;
private String message;
private Date date;
private User author;
}

and this is my library
spring.jar <2.0.7>
hibernate3.jar <3.2.5.ga>
hibernate4gwt-1.0.3.jar
gwt-sl-0.1.4f.jar


when i run, i get the exceptions..
ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
GwtSpringHibernate]] - ERROR: Could not find class
'net.sf.hibernate4gwt.sample.domain.Message_h4gwt_Proxy' listed in the
serialization policy file '/01EC66115A6A722B9144C5A999DED8C3.gwt.rpc';
your server's classpath may be misconfigured
java.lang.ClassNotFoundException:
net.sf.hibernate4gwt.sample.domain.Message_h4gwt_Proxy
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1362)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1208)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
com.google.gwt.user.server.rpc.SerializationPolicyLoader.loadFromStream(SerializationPolicyLoader.java:
94)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolicy(RemoteServiceServlet.java:
333)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy(RemoteServiceServlet.java:
218)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepareToRead(ServerSerializationStreamReader.java:
109)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:234)
at
org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:
310)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
187)
at
org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:
386)
at
org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:
49)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:
858)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:
792)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:
476)
at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:
441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
874)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
GwtSpringHibernate]] - WARNING: Failed to get the SerializationPolicy
'01EC66115A6A722B9144C5A999DED8C3' for module 'http://localhost:8080/
GwtSpringHibernate/'; a legacy, 1.3.3 compatible, serialization policy
will be used. You may experience SerializationExceptions as a result.


What's happen? I can't find the way to solve problem.Can u help me?
Thanks.
Message has been deleted

George Georgovassilis

unread,
Jul 14, 2008, 1:33:59 AM7/14/08
to gwt-sl
Hello there

I think Bruno told me once there is a class loading issue with
hibernate4gwt in servlet environments - we added a workaround for
this. So please download the latest version of hibernate4gwt (should
be v1.1 I think) and get from the source repository the latest version
of GWT-SL (not released yet) from either the 0.1.4 or 0.1.5 trunk,
depending on whether you use GWT 1.4.x or 1.5.

Regards,
George

On 14 Jul, 05:09, JumYom <bin...@gmail.com> wrote:
> Hi George,
> I try to integrate gwt-sl hibernate4gwt base on your example and
> hibernate4gwt's example but it's not work.http://groups.google.com/group/gwt-sl/browse_thread/thread/74f8719527...
Message has been deleted

JumYom

unread,
Jul 14, 2008, 6:29:12 AM7/14/08
to gwt-sl
Thanks for the response.
I also try the lastest gwt-sl1.4 version[gwt-sl-0.1.4f.jar] build from
branch version [https://gwt-widget.svn.sourceforge.net/svnroot/gwt-
widget/server/branches/0.1.4]
and the lastest version of hibernet4gwt[hibernate4gwt-1.1.jar].

I got errors when i compile java to js

Loading module 'net.sf.hibernate4gwt.sample.Sample'
Loading inherited module 'net.sf.hibernate4gwt.Hibernate4Gwt14'
[ERROR] Unable to load class
'net.sf.hibernate4gwt.rebind.GwtProxyGenerator'
java.lang.ClassNotFoundException:
net.sf.hibernate4gwt.rebind.GwtProxyGenerator
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.google.gwt.dev.cfg.ModuleDefSchema
$ObjAttrCvt.convertToArg(ModuleDefSchema.java:493) at
......



the lastest version have only
net.sf.hibernate4gwt.rebind.Gwt14ProxyGenerator and
net.sf.hibernate4gwt.rebind.Gwt15ProxyGenerator in distributed jar
file.
how can i build compatible version between the two libraries.
thanks a lot.

George Georgovassilis

unread,
Jul 14, 2008, 3:03:10 PM7/14/08
to gwt-sl
Do you mean that your project does not compile? I just double checked
the 0.1.4 and 0.1.5 branches of the SL, they compile fine with the
provided Ant build. Keep in mind that Hibernate4GWT changed its
packaging for release 1.1 - I had to change the integration and demo
code in the SL as well. For instance, the module import (*.gwt.xml) is
now:

<inherits name="net.sf.hibernate4gwt.Hibernate4Gwt14"/>

respectively

<inherits name="net.sf.hibernate4gwt.Hibernate4Gwt15"/>

for Java 5 support.

Also the POJOs now extend net.sf.hibernate4gwt.pojo.java14.LazyPojo
respectively net.sf.hibernate4gwt.pojo.java5.LazyPojo

JumYom

unread,
Jul 14, 2008, 10:43:02 PM7/14/08
to gwt-sl
yes, my project cannot compile with that error. I check out the
lastest lib both from svn and build from their ant.It is build find
with the result gwt-sl-0.1.4f.jar,hibernate4gwt-1.1b.jar .

but when i compile my project in eclipse(with cypal studio plugin) I
got that error, class net.sf.hibernate4gwt.rebind.GwtProxyGenerator
not found, then I checked hibernate4gwt project and found that the
class net.sf.hibernate4gwt.rebind.GwtProxyGenerator did not exist. I
just found the class net.sf.hibernate4gwt.rebind.Gwt14ProxyGenerator
and
net.sf.hibernate4gwt.rebind.Gwt15ProxyGenerator in svn source code.

My Sample.gwt.xml use <inherits
name="net.sf.hibernate4gwt.Hibernate4Gwt14"/> because this project's
POJOs is written in java1.4 style. and these POJOs are not extend
net.sf.hibernate4gwt.pojo.java14.LazyPojo but they are implement
Serializable(stateless mode).

I create my new project base on existing source code of hiberante4gwt
example (http://hibernate4gwt.sourceforge.net/
getting_started_stateless.html) and configuration of your project
(https://gwt-widget.svn.sourceforge.net/svnroot/gwt-widget/server/
branches/0.1.4) and the lastest library of both hibernate4gwt and gwt-
sl.


If this project is work, I will use this project to be template of my
many projects in my company.

thanks so much.

JumYom

unread,
Jul 14, 2008, 11:55:15 PM7/14/08
to gwt-sl
Now I found the problem. this is my fault. about the override
net.sf.hibernate4gwt.Hibernate4Gwt14.gwt.xml and I found new error.I
am solving new error. :-(

this error is occur when I compile project
Exception in thread "main" java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.Compiler.<init>(Lorg/eclipse/jdt/
internal/compiler/env/INameEnvironment;Lorg/eclipse/jdt/internal/
compiler/IErrorHandlingPolicy;Lorg/eclipse/jdt/internal/compiler/impl/
CompilerOptions;Lorg/eclipse/jdt/internal/compiler/
ICompilerRequestor;Lorg/eclipse/jdt/internal/compiler/
IProblemFactory;)V


Thanks for your help.

JumYom

unread,
Jul 15, 2008, 12:23:44 AM7/15/08
to gwt-sl
The first error that I found before all of these error is
ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
CAR]] - ERROR: Could not find class
'th.co.thainamthip.car.domain.ActionRequestHeader_h4gwt14' listed in
the serialization policy file '/
F6157CACB9DB18251EA3F0FF585E84AE.gwt.rpc'; your server's classpath may
be misconfigured
java.lang.ClassNotFoundException:
th.co.thainamthip.car.domain.ActionRequestHeader_h4gwt14
.......
INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
CAR]] - WARNING: Failed to get the SerializationPolicy
'F6157CACB9DB18251EA3F0FF585E84AE' for module 'http://localhost:8080/
CAR/'; a legacy, 1.3.3 compatible, serialization policy will be used.
You may experience SerializationExceptions as a result.

The ActionRequestHeader is implement Serializable, IsSerializable. I
think it should be fine, but I got this error evertime when I start
tomcat with this project.

Do you have any guide for me? Thank you so much.

George Georgovassilis

unread,
Jul 15, 2008, 12:52:56 AM7/15/08
to gwt...@googlegroups.com
I think you just forgot to copy the gerenated serialisation policy file
to the deployment directory. For details and background please check the
GWT forum.

JumYom

unread,
Jul 15, 2008, 2:44:02 AM7/15/08
to gwt-sl
This error occured only when I run with hibernate4gwt. I run the
project in eclipse that it's automatically copy file into deployment
directory, and I rechecked this file was exist in deployment
directory.


This error occur only when I compile and run with hibernate4gwt. with
out hibernate4gwt it work fine..with the problem of persistence
collection and lazy loading :-(.


Thanks for your help.

noon

unread,
Jul 15, 2008, 5:49:08 AM7/15/08
to gwt-sl
Hi,

My first question is about hibernate4gwt mode : are you using dynamic
proxy, stateless or stateful mode ?
The issue you encounter comes from the dynamic proxy mode. With it,
every *Serializable* instance created with GWT.create() is managed as
an hibernate4gwt proxy, which is the case for the ActionRequestHeader
class. can you create it using the *new* operator instead ?

Regards
Bruno

JumYom

unread,
Jul 15, 2008, 10:30:52 PM7/15/08
to gwt-sl
I try both stateless and dynamic proxy mode.
I create instance using GWT.create() in dynamic proxy mode follow the
hibernate4gwt documentation.
Both mode have same error. The ActionRequestHeader class is same to
other domain class, but only this class has exception.
I can't find the cause now.
How should I do now?

Thanks.

JumYom

unread,
Jul 15, 2008, 10:40:04 PM7/15/08
to gwt-sl
The hibernate4gwt's dynamic proxy mode force code to create instance
with GWT.create(); in initialization code.
Can you show the example snippet code for the *new* operation. How can
I use it in this situation.

JumYom

unread,
Jul 16, 2008, 12:06:39 AM7/16/08
to gwt-sl
I try to use new operation instead. this is a snippet code in
initialization code.

// GWT.create(ActionRequestHeader.class);
// GWT.create(CorrectiveActionRequest.class);

new ActionRequestHeader();
new CorrectiveActionRequest();

and I got exception
java.lang.RuntimeException: java.lang.UnsupportedOperationException:
Cannot merge Pure POJO without a stateful POJO store !
th.co.thainamthip.car.domain.CorrectiveActionRequest should implement
ILazyPojo...

snippet of CorrectiveActionRequest
public class CorrectiveActionRequest {
private ActionRequestHeader header;
}


Is this snippet code same to your suggestion?

George Georgovassilis

unread,
Jul 16, 2008, 1:08:18 AM7/16/08
to gwt...@googlegroups.com
Somehow you are overcomplicating things. Check the souce code for the
demo app in the SL, in particular the classes under the domain package
(Product and Order) and the ClientApplication.java for how the unit test
with hibernate4gwt is performed. There is really nothing much to it:
have your class extend LazyPojo from the right package (java14 or java5)
and you are done.

JumYom

unread,
Jul 16, 2008, 4:18:06 AM7/16/08
to gwt-sl
I already try the demo come with gwt-sl, but this demo does not test
hibernate4gwt.
It just test only handler, expoter of gwt-sl. The
HibernateDomainService class has not been called.

How can I set that demo to test hibernate4gwt?or I have to get from
another branches of gwt-sl project.

George Georgovassilis

unread,
Jul 16, 2008, 4:23:27 AM7/16/08
to gwt...@googlegroups.com
That is not true - look closer :-) For example, in the 0.1.5 branch:
ClientApplication.java, line 94 has code for invoking the HibernateDomainService

This service is then declared and bound to RPC in the hibernate4gwt-servlet.xml file

JumYom

unread,
Jul 16, 2008, 5:01:43 AM7/16/08
to gwt-sl
Oh, I use built library and try example from 0.1.4 branch of gwt-sl
because I use gwt 1.4.62, not gwt 1.5.
The ClientApplication.java in this branch has no invocation of
HibernateDomainService.
Should I use gwt-sl 0.1.5 instead? From my understanding, this version
should be used for gwt 1.5 only. Let me know if I'm wrong.

On Jul 16, 3:23 pm, "George Georgovassilis"

George Georgovassilis

unread,
Jul 17, 2008, 6:42:32 AM7/17/08
to gwt-sl
You are right - I forgot that while I was developping 0.1.4,
hibernate4gwt (back in the 1.0.x days) had so many client dependencies
that I backed-off from implementing a test. The new version 1.1 makes
it much more easy, so I backported the client test from SL 0.1.5. You
can find the complete example now in the SL 0.1.4 branch.

JumYom

unread,
Jul 21, 2008, 12:13:40 AM7/21/08
to gwt-sl
Ok. Now I can do it, in stateless mode from your example. It's work
now.

The last question, can gwt-sl use Dynamic Proxy mode of hibernate4gwt?

Thank you very much for your help.

George Georgovassilis

unread,
Jul 21, 2008, 1:52:40 AM7/21/08
to gwt...@googlegroups.com
Yes it can, but currently it doesn't work too well. The
HB4GWTRPCServiceExporter has a property "usingProxyClassLoader" - when
you set it to "true" it will use Hibernate4GWT's dynamic proxies.
However this introduces a few more dependencies, but I couldn't get it
to work because of some classloading issues. I am still looking into it.

Paul

unread,
Jul 26, 2008, 4:30:53 PM7/26/08
to gwt-sl, brunoma...@gmail.com, George Georgovassilis
I think I'm going mad.

George, remember when we had our mammoth email conversation, you were
helping me understand Spring and GWT-SL. Well during that time I was
using GWT 1.5RC, SL 0.1.5, Hibernate4gwt 1.0.something

Ok, I got everything working really nicely, and began a big project
with it! I had Sets working because I remember I had an example where
I have CDs and each CD had Tracks. I successfully retrieved the cds by
just doing a get() and then calling Hibernate.initialize(cd) to
populate the Tracks. I could then return the CD with its Set of Tracks
to the client and display it.

Now as I begun my project Sets stopped working. They were being
returned as PersistentSets which breaks the GWT-RPC. I thought
hibernate4gwt was supposed to sort this out.

So I thought I'd try my hand at Java reflection, and two hours later I
have a beautiful piece of code which can be blindly applied to any DTO
within a hibernate session and if it happens to contain any Sets, each
Set is first Hibernate.initialized and then the PersistentSet is
converted to a HashSet. Pretty neat solution! ... and it works, I've
tested it and all loads well in GWT client.

Anyhow in the mean time I figured this isn't right, hibernate4gwt is
supposed to do this. So I read up more and found out there is
hibernate4gwt1.1 and SL 0.1.5 is designed for that (even though I've
been using SL 0.1.5 for weeks now) so I decided to update and see if
it sorts these issues. I have made two changes, my gwt.xml now
inherits net.sf.hibernate4gwt.Hibernate4Gwt15 and my DTOs now
implement LazyPojo. And suddenly saving to the database is broken! I
get "Cannot merge Pure POJO without a stateful POJO store". I am using
it in stateless mode.

The one good thing about this new error is MAYBE if we can find out
what I've done wrong here it might also fix the PersistentSet problem.
Basically I'm getting the feeling that although I have hibernate4gwt
present I haven't got it configured to do anything! Not sure what
could have changed from a few weeks ago when I was testing. I have
implemented Acegi, but tested and that's ok, and I am using GXT. Also
I split up my applicationContext.xml into various xml files, but if
one of them wasn't being read I'm sure Spring would shout at me.



On Jul 21, 8:52 am, George Georgovassilis <g.georgovassi...@gmail.com>
wrote:

Paul

unread,
Jul 26, 2008, 5:08:14 PM7/26/08
to gwt-sl, brunoma...@gmail.com, George Georgovassilis
As if it wasn't going badly enough for me aleady...

I just decided to revert to my old set up of
hibernate4gwt-1.0.4_GWT_1.5RC1 and I had to change back my .gwt.xml
and my DTO extend LazyGwtPojo, and now I get this [1].

Ok here's another thought. I used to have ALL these in my deploy lib:
beanlib-3.3.0beta10.jar
beanlib-hibernate-3.3.0beta10.jar
beanlib-3.3.0beta17.jar
beanlib-hibernate-3.3.0beta17.jar

and then when I read the release notes for hibernate4gwt1.1 I scrapped
them all in favour of:
beanlib-3.3.0beta16.jar
beanlib-hibernate-3.3.0beta16.jar

could THAT be a cause?

[1]:

Jul 27, 2008 12:01:07 AM org.apache.catalina.core.ApplicationContext
log
SEVERE: Exception while dispatching incoming RPC call
java.lang.NoSuchMethodError:
net.sf.beanlib.hibernate.UnEnhancer.unenhance(Ljava/lang/Class;)Ljava/
lang/Class;
at
net.sf.hibernate4gwt.core.hibernate.HibernateUtil.getId(HibernateUtil.java:
137)
at
net.sf.hibernate4gwt.core.store.stateless.StatelessPojoStore.restore(StatelessPojoStore.java:
108)
at
net.sf.hibernate4gwt.core.HibernateBeanManager.mergePojo(HibernateBeanManager.java:
453)
at
net.sf.hibernate4gwt.core.HibernateBeanManager.merge(HibernateBeanManager.java:
278)
at
net.sf.hibernate4gwt.gwt.HibernateRPCHelper.parseInputParameters(HibernateRPCHelper.java:
80)
at
org.gwtwidgets.server.spring.hb4gwt.HB4GWTRPCServiceExporter.invokeMethodOnService(HB4GWTRPCServiceExporter.java:
44)
at
org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:
298)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
85)
at
org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:
363)
at
org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:
49)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:
875)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:
809)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:
571)
at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:
511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
107)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
72)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:
124)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:
125)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:
271)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:
110)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.securechannel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:
138)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:
249)
at org.acegisecurity.util.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:
149)
at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:
98)
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:
228)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
216)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
844)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
445)
at java.lang.Thread.run(Unknown Source)

George Georgovassilis

unread,
Jul 27, 2008, 4:44:03 AM7/27/08
to Paul, gwt-sl, brunoma...@gmail.com
G'd day lads

A lot of people are complaining about the PersistentSet, but I don't
know what's going wrong. I just added a test for Sets to the 0.1.5
branch and it works fabulously. Can you check it out
(ClientApplication.java, HibernateDomainServiceImpl and the domain
stuff) and tell me what you are doing differently?

noon

unread,
Jul 27, 2008, 2:46:02 PM7/27/08
to gwt-sl
Hi Paul,

hibernate4gwt seems active since you got the "pure POJO merge" error
message (basically, it means that the merge operation received a pojo
that do not implement the ILazyPojo interface and the pojo store is
declared as stateless).
Can you post your POJO class and GWT service so George and I can check
if everything is ok.

About your last exception, the only thing I can tell you is that the
beanlib version is wrong (as far as I can remember, latests 1.0.4
releases comes with beanlib beta12).

Regards
Bruno


On 27 juil, 10:44, George Georgovassilis <g.georgovassi...@gmail.com>
wrote:

Paul Schwarz

unread,
Aug 9, 2008, 6:17:56 PM8/9/08
to George Georgovassilis, gwt-sl, brunoma...@gmail.com
Hi all

I am using GWT-SL-0.1.5, Hibernate3, hibernate4gwt-1.0.4_GWT_1.5RC1, GWT 1.5, GXT (or GWT EXT). I'm using hibernate4gwt in stateless mode and I'm using GWT-SL as Service Exporter. In an AOP manner I have written a class called MyHB4GWTRPCServiceExporter. This means I can intercept exceptions like invocation target exceptions before they go to GWT client as meaningless exceptions.

Ok, without GWT EXT I have NO problems. I can get complex collections of data from the database and transport them as pojos to my client, thanks to hibernate4gwt and GWT-SL. I like the power of pojos and hibernate4gwt, but with GXT I am able to set up bound widgets like data tables, combo boxes, etc very easily and elegantly if I stick to their Model idea. The Model is a map where you set your persistent fields as Key/Value pairs. This forms a naive sort of introspection. It works, but I like to be able to say user.getRoles() and not ((Roles) user.get("roles")). So how to get the best of both worlds? Well I thought I was being clever... and maybe was! I basically stuck to the Pojo idea that hibernate4gwt uses. But your pojos need to extend LazyGwtPojo if you're going to make hibernate4gwt happy, and need to extend BaseModel to make GXT happy. Can't have multiple inheritance. Truth is you don't NEED to extend LazyGwtPojo, you just need to implement ILazyPojo and its 4 methods. So I opened LazyGwtPojo and select all/copy/paste into a new class called MyLazyGwtPojo, which extends BaseModel (and implements ILazyPojo) so everyone's happy.

Now in my domain objects I realise that the properties are set using reflection via their setter methods. A pojo's setter looks like this:

public void setName(String name){
    this.name = name;
}

and a Model's setter looks like this:

public void setName(String name){
    set("name", name);
}

so my hybrid looks like this:

public void setName(String name){
    set("name", name);
    this.name = name;
}

and again everyone is happy.

I tried it and it worked. To test I would do something like GWT.log(user.getName(), null); to check that the pojo side of things was working, and to test the Model side of things you need to use your object to put in a ListStore and then bind to a ComboBox, or something. It all worked.

Even transporting an object with a collection like a Set works.

But now the problem. In GXT you don't simply set up the normal AsyncCallback etc and invoke the service. You first set up data loading proxies and all sorts that kind of wrap up and abstract away some of the low details of paging/sorting requests, reloading, etc. Under the hood of course it's just normal GWT. Although sometimes I wonder because if I use GXT to retrieve something complex (a list of objects that have Sets of other objects - like teachers and their students) then suddenly the program has all the symptoms that hibernate4gwt has packed up and gone home. Sets are being sent to GWT as PersistentSets for instance which causes GWT to fail.

This gave me such headaches until I found this post http://extjs.com/forum/showthread.php?t=36428 where Maku seems like he's found the answer! I followed closely and he give away a bit more on page 2. Anyway finally piecing it all together I get this: in MyHB4GWTRPCServiceExporter I put the AOP advice method:

    @Override
    public String invokeMethodOnService(Object service, Method targetMethod, Object[] targetParameters, RPCRequest rpcRequest) throws Exception {
       
        Object result = targetMethod.invoke(service, targetParameters);
           
        LazyKiller killer = new LazyKiller(null, HibernateUtil.getInstance());
        if (result != null){
            result = killer.detach(result);
        }
       
        String encodedResult = RPC.encodeResponseForSuccess(rpcRequest.getMethod(), result, rpcRequest.getSerializationPolicy());
       
        logger.debug(encodedResult);
       
        return encodedResult;       
    }
   
... and magically hibernate4gwt is back in the game! No more PersistentSets! They're all being converted back to safe HashSets.

Here it works (getting a "User" from the database with its associated "Authorities"):

//OK[0,9,21,10,13,20,6,13,19,6,13,18,-10,17,6,13,16,6,13,15,14,13,12,8,11,1,0,7,6,28,5,6,10,6,6,1,9,0,0,1,0,7,-1,6,143,5,8,3,0,1,0,7,-1,6,144,5,4,3,2,2,1,["ke.co.mss.gsh.domain.Users/2708089464","java.util.HashSet/1594477813","ke.co.mss.gsh.domain.Authorities/396700231","ROLE_OFFICER","java.lang.Integer/3438268394","a","java.util.ArrayList/3821976829","ROLE_ADMIN","java.lang.Boolean/476441737","xxx","com.extjs.gxt.ui.client.data.RpcMap/3441186752","enabled","java.lang.String/2004016611","Yes","username","phone","userid","lastname","firstname","password","deleted"],0,3]

But now here's me trying to get an entire list of Users:

//OK[0,0,0,1,["com.extjs.gxt.ui.client.data.BasePagingLoadResult/496878394"],0,3]

BasePagingLoadResult is a wrapper that keeps a List of data and extra meta data like page offset and page limit (for paging). So you'd do myBasePagingLoadResult.getData() to get a List of Users. The list is full, if I put debug statements on the server I can see it has data. When I return it to the client I get //OK[0,0,0,1,["com.extjs.gxt.ui.client.data.BasePagingLoadResult/496878394"],0,3] so the object is not null, but myBasePagingLoadResult.getData() returns null!

If someone knows where my data has gone please let me know.

Thanks Paul



2008/7/27 George Georgovassilis <g.georgo...@gmail.com>

noon

unread,
Aug 10, 2008, 4:55:29 PM8/10/08
to gwt-sl
Hi Paul,

To answer your final question, the GXT BaseLoadingPage class is not a
Java Bean, that's why the 'data' member is null (there is a 'getData'
method, but 'setData' is missing _ see here http://extjs.com/forum/showthread.php?p=201823).
Fortunately, Darrell Meier fixed this and you can benefit from it in
GXT SVN.

The second point is : do NOT use LazyKiller alone. This class is just
a piece of Hibernate4GWT, not its heart (it is good enough for sending
Hibernate beans out of the server, but not for merging them back...).
Use HibernateRPCHelper (or HibernateBeanManager) instead.

Hope this helps
Bruno
> This gave me such headaches until I found this posthttp://extjs.com/forum/showthread.php?t=36428where Maku seems like he's
> 2008/7/27 George Georgovassilis <g.georgovassi...@gmail.com>
> ...
>
> read more »

noon

unread,
Aug 11, 2008, 3:29:42 AM8/11/08
to gwt-sl
Hi all,

To answer your last question, the issue comes from GXT : the
BaseLoadList class has a 'getData' method, but 'setData' is missing
(see http://extjs.com/forum/showthread.php?p=201823 for details)
Fortunately, Darrell Meyer fixed it and correction is available on the
GXT SVN...

The second poinjt is : do not use LazyKiller alone. This class is not
the very heart of Hibernate4GWT and if it is good enough for clone
operation (send Hibernate beans to GWT client side), it is not for
merge one ! Please use HibernateRPCHelper (or HibernateBeanManager)
instead...

Hope this helps !
Bruno

On 10 Aug, 00:17, "Paul Schwarz" <paulsschw...@gmail.com> wrote:
> This gave me such headaches until I found this posthttp://extjs.com/forum/showthread.php?t=36428where Maku seems like he's
> 2008/7/27 George Georgovassilis <g.georgovassi...@gmail.com>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages