pupsnow / dphibernate

Automatically exported from code.google.com/p/dphibernate
0 stars 0 forks source link

NullPointerException with Spring-BlazeDS Lazy Loading configuration for OneToMany relations #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Declare two entity linked by OneToMany (Parent->OneToMany->Child) relation. 
Owner relationship has a List with a collection of objects. (Parent.childs)
2. Adding other ManyToOne relations Lazy loading works fine, but not with 
ArrayCollection. FetchType.EAGER works fine.

What is the expected output? What do you see instead?
Not lazy collection.

What version of the product are you using? 
Spring3-BlazeDS4-dpHibernate2.0-RC6-Hibernate-3.3-MySQL-Flex SDK 4+
On what operating system?
Windows 7

Please provide any additional information below.
Error I obtain:
========================
10:40:44,763 DEBUG SessionImpl:220 - opened session at timestamp: 13390584447
10:40:44,787 DEBUG SessionImpl:220 - opened session at timestamp: 13390584447
{operation})****************getPadreList
10:40:44,788 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open 
PreparedStatements: 0, globally: 0)
10:40:44,788 DEBUG ConnectionManager:415 - opening JDBC connection
10:40:44,789 DEBUG SQL:393 - select this_.id as id0_0_, this_.name as name0_0_ 
from prueba.padre this_
Hibernate: select this_.id as id0_0_, this_.name as name0_0_ from prueba.padre 
this_
10:40:44,789 DEBUG AbstractBatcher:374 - about to open ResultSet (open 
ResultSets: 0, globally: 0)
10:40:44,789 DEBUG Loader:1164 - result row: EntityKey[es.prueba.model.Padre#1]
10:40:44,790 DEBUG Loader:1164 - result row: EntityKey[es.prueba.model.Padre#2]
10:40:44,791 DEBUG Loader:1164 - result row: EntityKey[es.prueba.model.Padre#3]
10:40:44,791 DEBUG AbstractBatcher:381 - about to close ResultSet (open 
ResultSets: 1, globally: 1)
10:40:44,792 DEBUG AbstractBatcher:366 - about to close PreparedStatement (open 
PreparedStatements: 1, globally: 1)
10:40:44,792 DEBUG TwoPhaseLoad:107 - resolving associations for 
[es.prueba.model.Padre#1]
10:40:44,792 DEBUG TwoPhaseLoad:206 - done materializing entity 
[es.prueba.model.Padre#1]
10:40:44,792 DEBUG TwoPhaseLoad:107 - resolving associations for 
[es.prueba.model.Padre#2]
10:40:44,793 DEBUG TwoPhaseLoad:206 - done materializing entity 
[es.prueba.model.Padre#2]
10:40:44,794 DEBUG TwoPhaseLoad:107 - resolving associations for 
[es.prueba.model.Padre#3]
10:40:44,794 DEBUG TwoPhaseLoad:206 - done materializing entity 
[es.prueba.model.Padre#3]
10:40:44,794 DEBUG StatefulPersistenceContext:748 - initializing non-lazy 
collections
10:40:44,794 DEBUG DistinctRootEntityResultTransformer:46 - transformed: 3 rows 
to: 3 distinct results
10:40:44,794 DEBUG ConnectionManager:296 - transaction completed on session 
with on_close connection release mode; be sure to close the session to release 
JDBC resources!
{invoke} 7
java.lang.NullPointerException
    at org.dphibernate.serialization.HibernateSerializer.getCollectionProxies(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeAbstractPersistentCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.adapters.RemotingAdapter.invoke(Unknown Source)
    at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
    at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1406)
    at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
    at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.serviceMessage(<generated>)
    at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
    at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
    at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
    at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
    at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
    at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:308)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.service(<generated>)
    at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
    at org.dphibernate.serialization.HibernateSerializer.getCollectionProxies(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeAbstractPersistentCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.adapters.RemotingAdapter.invoke(Unknown Source)
    at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
    at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1406)
    at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
    at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.serviceMessage(<generated>)
    at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
    at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
    at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
    at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
    at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
    at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:308)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.service(<generated>)
    at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
    at org.dphibernate.serialization.HibernateSerializer.getCollectionProxies(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeAbstractPersistentCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeCollection(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.writeBean(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.serialization.HibernateSerializer.serialize(Unknown Source)
    at org.dphibernate.adapters.RemotingAdapter.invoke(Unknown Source)
    at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
    at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1406)
    at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
    at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.serviceMessage(<generated>)
    at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
    at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
    at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
    at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
    at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
    at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:308)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$2c4cc0f6.service(<generated>)
    at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647){serialize} 8

    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
10:40:44,803 DEBUG ConnectionManager:435 - releasing JDBC connection [ (open 
PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
10:40:44,804 DEBUG ConnectionManager:296 - transaction completed on session 
with on_close connection release mode; be sure to close the session to release 
JDBC resources!
========================

Original issue reported on code.google.com by arcadioc...@gmail.com on 7 Jun 2012 at 8:53

GoogleCodeExporter commented 9 years ago
I've got it!, sorry but there were a problem width "flex-servlet.xml" 
configuration. Missing:
<context:component-scan base-package="es.*" />
<context:annotation-config />
<tx:annotation-driven />

Original comment by arcadioc...@gmail.com on 10 Jun 2012 at 8:36