cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yahoo <hansheinrichbr...@yahoo.de>
Subject Re: URLResponse from Restcontroller with Hibernate circular relationships
Date Sat, 08 Mar 2014 06:26:06 GMT
Ok,

I am thinking to put some lazy loading patterns in the service classes 
of the
accessroutines.But now I face  another problem.
I am using in the sample part of the cocoon distribution the 
DemoRectController to access
the data via Hibernate and the calling the URLResponse.
When I call  this controller the first time I get the error:
<exception-reportclass="org.hibernate.LazyInitializationException"timestamp="Sat, 
08 Mar 2014 07:20:02 +0100">
<message>could not initialize proxy - no Session</message>
<stacktrace>
org.hibernate.LazyInitializationException: could not initialize proxy - 
no Session at 
org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:186)

at 
org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:545)

at 
org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:124)

at 
org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:266) 
at 
org.apache.cocoon.sample.controller.BraunimmobilienRESTController.doGet(BraunimmobilienRESTController.java:65)

at 
org.apache.cocoon.rest.controller.MethodDelegator$GetDelegate.execute(MethodDelegator.java:128)

at 
org.apache.cocoon.rest.controller.MethodDelegator.delegate(MethodDelegator.java:63) 
at 
org.apache.cocoon.rest.controller.SpringRESTController.setup(SpringRESTController.java:119)

at 
org.apache.cocoon.controller.SpringControllerComponent.setup(SpringControllerComponent.java:110)

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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.PipelineComponentProfilingAspect.handleInvocation(PipelineComponentProfilingAspect.java:41)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy92.setup(Unknown Source) at 
org.apache.cocoon.pipeline.AbstractPipeline.setupComponents(AbstractPipeline.java:181) 
at 
org.apache.cocoon.pipeline.AbstractPipeline.setup(AbstractPipeline.java:132) 
at 
org.apache.cocoon.pipeline.CachingPipeline.setup(CachingPipeline.java:183) 
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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.PipelineProfilingAspect.handleInvocation(PipelineProfilingAspect.java:41)

at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy90.setup(Unknown Source) at 
org.apache.cocoon.sitemap.InvocationImpl.execute(InvocationImpl.java:145) at 
org.apache.cocoon.sitemap.node.PipelineNode.invoke(PipelineNode.java:69) 
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.SitemapNodeProfilingAspect.handleInvocation(SitemapNodeProfilingAspect.java:43)

at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy87.invoke(Unknown Source) at 
org.apache.cocoon.sitemap.node.AbstractSitemapNode.invoke(AbstractSitemapNode.java:100) 
at 
org.apache.cocoon.sitemap.node.PipelinesNode.invoke(PipelinesNode.java:50) 
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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.SitemapNodeProfilingAspect.handleInvocation(SitemapNodeProfilingAspect.java:43)

at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy87.invoke(Unknown Source) at 
org.apache.cocoon.sitemap.node.AbstractSitemapNode.invoke(AbstractSitemapNode.java:100) 
at org.apache.cocoon.sitemap.node.Sitemap.invoke(Sitemap.java:43) 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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.SitemapNodeProfilingAspect.handleInvocation(SitemapNodeProfilingAspect.java:43)

at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy87.invoke(Unknown Source) at 
org.apache.cocoon.servlet.RequestProcessor.invoke(RequestProcessor.java:245) 
at 
org.apache.cocoon.servlet.RequestProcessor.sendSitemapResponse(RequestProcessor.java:313)

at 
org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java:92) 
at 
org.apache.cocoon.servlet.XMLSitemapServlet.service(XMLSitemapServlet.java:49) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) 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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.ServletProfilingAspect.handleInvocation(ServletProfilingAspect.java:48)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.monitoring.statistics.aspects.UrlHitCountStatisticsAspect.handleUrlRequest(UrlHitCountStatisticsAspect.java:47)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.monitoring.statistics.aspects.ServletHitCountStatisticsAspect.handleServletRequest(ServletHitCountStatisticsAspect.java:45)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)

at 
org.apache.cocoon.jnet.URLHandlerFactoryCollector.installURLHandlers(URLHandlerFactoryCollector.java:37)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy72.service(Unknown Source) at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:485)

at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:459)

at 
org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:245)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy73.service(Unknown Source) 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:606) at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.profiling.aspects.InvocationDispatcher.dispatch(InvocationDispatcher.java:68)

at 
org.apache.cocoon.profiling.aspects.ServletProfilingAspect.handleInvocation(ServletProfilingAspect.java:48)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.monitoring.statistics.aspects.UrlHitCountStatisticsAspect.handleUrlRequest(UrlHitCountStatisticsAspect.java:47)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)

at 
org.apache.cocoon.monitoring.statistics.aspects.ServletHitCountStatisticsAspect.handleServletRequest(ServletHitCountStatisticsAspect.java:45)

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:606) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)

at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)

at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) 
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)

at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
at com.sun.proxy.$Proxy73.service(Unknown Source) at 
org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:106) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServlet.service(ReloadingServlet.java:115)

at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) 
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221) 
at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingSpringFilter.doFilter(ReloadingSpringFilter.java:71)

at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter.doFilter(ReloadingServletFilter.java:66)

at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) 
at 
org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:152)

at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter.doFilter(ReloadingServletFilter.java:66)

at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) 
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) 
at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 
at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) 
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) 
at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)

at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) 
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
at org.mortbay.jetty.Server.handle(Server.java:326) at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) 
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at 
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at 
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) 
at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
</stacktrace>
</exception-report>

When I call a second time everything works fine.
Maybe it's the way I introduced the lazy loading filter here is the web.xml:

<?xml version="1.0" encoding="UTF-8"?><!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
--><web-app>

   <context-param>
<param-name>shieled-classloader-use-repository</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener</param-name>
<param-value>org.springframework.web.context.ContextLoaderListener,org.springframework.web.context.request.RequestContextListener</param-value>
</context-param>
<context-param>
     <param-name>contextClass</param-name>
<param-value>org.apache.cocoon.tools.rcl.springreloader.SynchronizedConfigureableWebApplicationContext</param-value>
   </context-param>

   <filter>
     <filter-name>ReloadingSpringFilter</filter-name>
     <display-name>ReloadingSpringFilter</display-name>
     <description>Reloads the Spring application context if a 
classloader change was detected.</description>
<filter-class>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter</filter-class>
   <init-param>
<param-name>filter-class</param-name>
<param-value>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingSpringFilter</param-value>
</init-param>
</filter>
   <filter>
         <filter-name>lazyLoadingFilter</filter-name>
<filter-class>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter</filter-class>
     <init-param>
<param-name>filter-class</param-name>
<param-value>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</param-value>
</init-param>
</filter>


   <filter-mapping>
     <filter-name>ReloadingSpringFilter</filter-name>
     <servlet-name>DispatcherServlet</servlet-name>
   </filter-mapping>
    <filter-mapping>
         <filter-name>lazyLoadingFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>


   <listener>
<listener-class>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener</listener-class>
   </listener>


   <servlet>
     <servlet-name>DispatcherServlet</servlet-name>
     <display-name>DispatcherServlet</display-name>
     <description>Cocoon blocks dispatcher</description>
<servlet-class>org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServlet</servlet-class>
     <init-param>
<param-name>servlet-class</param-name>
<param-value>org.apache.cocoon.servletservice.DispatcherServlet</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
     <servlet-name>DispatcherServlet</servlet-name>
     <url-pattern>/*</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>DispatcherServlet</servlet-name>
     <url-pattern>*.jsp</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>DispatcherServlet</servlet-name>
     <url-pattern>*.html</url-pattern>
   </servlet-mapping>

   <!-- various MIME type mappings 
====================================== -->
   <mime-mapping>
     <extension>css</extension>
     <mime-type>text/css</mime-type>
   </mime-mapping>
   <mime-mapping>
     <extension>xml</extension>
     <mime-type>text/xml</mime-type>
   </mime-mapping>
   <mime-mapping>
     <extension>xsl</extension>
     <mime-type>text/xml</mime-type>
   </mime-mapping>
   <mime-mapping>
     <extension>xmap</extension>
     <mime-type>text/xml</mime-type>
   </mime-mapping>
   <mime-mapping>
     <extension>ent</extension>
     <mime-type>text/plain</mime-type>
   </mime-mapping>
   <mime-mapping>
     <extension>grm</extension>
     <mime-type>text/plain</mime-type>
   </mime-mapping>

</web-app>


Am 07.03.2014 11:12, schrieb gelo1234:
> Hi,
>
> I think there is no common pattern. It solely depends on your usage 
> scenario. If you don't need to use a reverse side of the relationship 
> in your business logic, I would recommend removing that part.
> Mind some of the intricacies though e.g. if you remove the parent 
> reference field in child and not specify in parent that this column 
> must _not_ be null, you can get Exception with some persistence providers:
> http://stackoverflow.com/questions/12755380/jpa-persisting-a-unidirectional-one-to-many-relationship-fails-with-eclipselin
>
> Speaking from experience, Hibernate is very "tolerant" compared to 
> e.g. OpenJPA or EclipseLink
>
> Greetings,
> Greg
>
>
> 2014-03-07 10:15 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de 
> <mailto:hansheinrichbraun@yahoo.de>>:
>
>     Hello Greg,
>     Your solution works fine.
>     With a lot of Lazy Loading and circular relations
>     I have the idea to include the decision which relations should be
>     really  loaded
>     and which should be nulled
>     in the Dao.Do you know if there is already a professional solution
>     for this usage?
>
>
>     Am 04.03.2014 23:47, schrieb gelo1234:
>>
>>     Another kind of "hack" (if you cannot modify entity sources and
>>     they are not external .xml files) would be setting all child
>>     objects' parent references to null _before_ serializing that data.
>>
>>     Lets say you got: Author and Book entites with One-To-Many
>>     relationship.
>>
>>     You retrieve the entities from db and _before_ URLResponse, you
>>     modify
>>     all Books entities with null reference to parent(Author) entity:
>>
>>
>>     List<Author> authors = hibernateDAO.getAllAuthors();
>>
>>     // make sure hibernate session is closed and authors objects are
>>     _detached_
>>     // with full data structure -> FetchType.EAGER
>>
>>     for (Author author: authors) {
>>     List<Book> books = author.getBooks();
>>           for (Book book: books)
>>     book.setAuthor(null);
>>     }
>>
>>     Now you can safely call URLResponse with authors (they don't
>>     contain any circular references anymore).
>>
>>     Greetings,
>>     Greg
>>
>>
>>
>>     2014-03-04 23:00 GMT+01:00 gelo1234 <gelo1234@gmail.com
>>     <mailto:gelo1234@gmail.com>>:
>>
>>         Hi
>>
>>         Can you debug where exactly a problem with circular
>>         references exists ?
>>         Is it during serialization of your data ? StringTemplate?
>>         IOUtils?
>>
>>         Many serialization techniques/libs do have problems with such
>>         references, be it JAXB or GSON. For JAXB you can setup
>>         @Transient annotation.
>>
>>         How about a quick fix, that removes one side of relationship
>>         in Hibernate entities making it uni-directional instead of
>>         bi-directional e.g. reverse side ?
>>
>>         Greetings,
>>         Greg
>>
>>
>>
>>         2014-03-04 22:29 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>         <mailto:hansheinrichbraun@yahoo.de>>:
>>
>>             I am using Hibernate 4.1.8-Final and cocoon
>>             3.0.0-beta-1-SNAPSHOT.
>>             But why you ask?
>>             Am 03.03.2014 08:09, schrieb Francesco Chicchiriccò:
>>
>>                 On 03/03/2014 04:36, Yahoo wrote:
>>
>>                     I  am using cocoon RestController to present my
>>                     Hibernate Mysql data in pdf files.
>>                     The Hibernate structure has cirular
>>                     relationships, so when I give the structure to
>>                     the URLResponse there are endless StringBuilder
>>                     calls.Do you have an idea how to solve this
>>                     problem.One idea would be to present the data in
>>                     an non Hibernate bean without cicular
>>                     relationships. But may be there is an opportunity
>>                     to avoid new beans.
>>
>>
>>                 Hi,
>>                 such problems arise every time JPA (or other
>>                 persistence frameworks) entities are published (via
>>                 REST in your case) without any transformation (the
>>                 DTO pattern): I am afraid there is any cleaner
>>                 solution than converting your Hibernate entities into
>>                 something simpler.
>>
>>                 BTW: which version are you using?
>>
>>                 Regards.
>>
>>
>>
>>             ---------------------------------------------------------------------
>>             To unsubscribe, e-mail:
>>             users-unsubscribe@cocoon.apache.org
>>             <mailto:users-unsubscribe@cocoon.apache.org>
>>             For additional commands, e-mail:
>>             users-help@cocoon.apache.org
>>             <mailto:users-help@cocoon.apache.org>
>>
>>
>>
>
>


Mime
View raw message