You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yahoo <ha...@yahoo.de> on 2014/03/03 04:36:50 UTC

URLResponse from Restcontroller with Hibernate circular relationships

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by gelo1234 <ge...@gmail.com>.
Anyway I'm curious if you keep your Hibernate session _open_ between two
HTTP Requests (second is calling String-template servlet? until View is
completely rendered) ?
Do you use open-session-in-view pattern or any other ? Conversations
spanning several request-response cycles ?
https://community.jboss.org/wiki/OpenSessionInView

Greetings,
Greg


2014-03-05 4:52 GMT+01:00 Yahoo <ha...@yahoo.de>:

>  Thanks Greg,That's the idea as long as I don't save the bean there is no
> problem
> with the database. And such methods I already use with Lazy loading
> between two requests.
>
> 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 <ge...@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 <ha...@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
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>
>

Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by gelo1234 <ge...@gmail.com>.
Yup, Lazy loading will cause problems in this scenario. How about making
Hibernate session readOnly ? :)

http://stackoverflow.com/questions/5800814/is-it-possible-to-detach-hibernate-entity-so-that-changes-to-object-are-not-aut


Greetings,
Greg


2014-03-05 4:52 GMT+01:00 Yahoo <ha...@yahoo.de>:

>  Thanks Greg,That's the idea as long as I don't save the bean there is no
> problem
> with the database. And such methods I already use with Lazy loading
> between two requests.
>
> 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 <ge...@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 <ha...@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
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>
>

Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by Yahoo <ha...@yahoo.de>.
Thanks Greg,That's the idea as long as I don't save the bean there is no 
problem
with the database. And such methods I already use with Lazy loading 
between two requests.

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 
> <ma...@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
>     <ma...@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
>         <ma...@cocoon.apache.org>
>         For additional commands, e-mail: users-help@cocoon.apache.org
>         <ma...@cocoon.apache.org>
>
>
>


URLResponse from Restcontroller and Hibernate

Posted by Yahoo <ha...@yahoo.de>.
Ok,


I am using in the sample part of the cocoon distribution the 
DemoRestController to access
the data via Hibernate and then 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"?><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>



Re: Jexl in embedded Pipeline

Posted by Yahoo <ha...@yahoo.de>.
Hello Greg,

I got  what I was looking for by using a programmed Pipeline.
Starting with Velocity to fill up an xmlstring with Hibernate bean data.
The only problem is that sometimes when I call Hibernate I get an error 
because there is no Hibernate session.
Maybe the reason is how I placed the lazy loading filte in the web.xm.

When I have time I investgate several other opportunities.

JAXBGenerator here I am missing some fields. I still don't know what is 
the reason. Maybe because I mix up different annotations.(Hibernate,  JAXB)

What is also working is simple calling the cocoon pipline snippets by 
localhost:8888

I am also trying to get the result of the URLResponse in the 
application. But till now I was not successful.

I also succeeded to replace Velocity by using the StringGenerator.

The last aspect I am investigating is using more cloud technology by 
sending only links.
But here I have to think about that the Information should not publicly 
accessible.

Greetings
Heiner


Am 14.03.2014 08:25, schrieb gelo1234:
> Cocoon 3 pipelines are either SAX or StAX events based so they operate 
> upon xml data. If you could feed XML into another pipeline component 
> that's fine. Just ask yourself if you really need Cocoon for the task 
> you are trying to complete.
>
> Greetings,
> Greg
>
>
> 2014-03-14 6:13 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de 
> <ma...@yahoo.de>>:
>
>     I found what I want todo. It's not  Jexl it's the VelocityEngine I
>     need.
>     Here is the example from spring mail.
>
>         MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
>                  message.setTo(user.getEmailAddress());
>                  message.setFrom("webmaster@csonth.gov.uk"  <ma...@csonth.gov.uk>);/// could be parameterized.../
>                  Map model = new HashMap();
>                  model.put("user", user);
>                  String text = VelocityEngineUtils.mergeTemplateIntoString(
>                     velocityEngine, "com/dns/registration-confirmation.vm", model);
>                  message.setText(text, true);
>
>
>     In my case the text comes from an inline Cocoon Pipeline.
>     I could first import the template use the Velocity Engine and then
>     give it to the Pipeline.
>     or is there possibility to make the job done by the pipeline .
>
>     Am 13.03.2014 19:34, schrieb gelo1234:
>>     I don't know about the attachments but a clean Cocoon3 extension
>>     for sending emails you can find here:
>>
>>     https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java
>>
>>     Greetings,
>>     Greg
>>
>>
>>     2014-03-13 15:02 GMT+01:00 Piratenvisier
>>     <hansheinrichbraun@yahoo.de <ma...@yahoo.de>>:
>>
>>         An application like this I use already.
>>         Thorsten Scherler made this email Application for me.
>>         The important point: I want to send an email and the Email
>>         Text and the attachements are produced by cocoon pipelines.
>>         This a an important part of my cocoon 2.10 application which
>>         I wanted to transfer to 3.0
>>
>>         Am 13.03.2014 14:23, schrieb gelo1234:
>>>         I got lost with your explanation :) It's a kind of awkward
>>>         thing to me that you are actually trying to do with that code.
>>>
>>>
>>>         Why not making it clean:
>>>
>>>         1. First you need a String-Template match to serialize the
>>>         Hibernate bean -> output XML with final values
>>>
>>>         <map:match  pattern="hibernate/bean">
>>>                  <map:generate  src="bean.xml"  type="stringtemplate"  />
>>>                  <map:serialize  type="xml"  />
>>>         </map:match>
>>>         where bean.xml is your [input]
>>>
>>>         You can now feed angebot bean data into hibernate/bean pipe
>>>         above (to get it serialized):
>>>         <map:match  pattern="hibernate/{id}">
>>>                  <controller:call  controller="rest-controller"  select="BeanController">
>>>                    <map:parameter  name="id"  value="{map:id}"  />
>>>                  </controller:call>
>>>         </map:match>
>>>
>>>
>>>         @RESTController
>>>         public  class  BeanController  implements  Get  {
>>>
>>>              @SitemapParameter
>>>              private  String  id;
>>>
>>>              @RequestParameter
>>>              private  String  name;
>>>            
>>>              // through injection or other way
>>>
>>>              HibernateDAO dao;
>>>
>>>               public  RestResponse  doGet()  throws  Exception  {
>>>                  Map<String,  Object>  data=  new  HashMap<String,  Object>();
>>>                  data.put("angebot",  dao.getAngebotBean(id));
>>>                  data.put("name",  this.name);
>>>
>>>                  return  new  Page("servlet:/hibernate/bean",  data);
>>>              }
>>>         }
>>>         At this point you got your Hibernate bean serialized (into
>>>         XML data).
>>>
>>>         2. Second you can go for XSLT Transformer and transform XML
>>>         into anything you want
>>>
>>>         You don't need any JEXL here.
>>>
>>>
>>>         Greetings,
>>>         Greg
>>>
>>>
>>>
>>>
>>>         2014-03-13 13:30 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>>         <ma...@yahoo.de>>:
>>>
>>>             I used the EmailPlainPipe from the distribution:
>>>               byte[] bytes = (byte[]) parameters.get("input");
>>>                     XMLGenerator generator = new XMLGenerator(bytes);
>>>             this.addComponent(generator);
>>>                     byte[] xsl = (byte[]) parameters.get("xsl");
>>>                     Source xslSource = new StreamSource(new
>>>             ByteArrayInputStream(xsl));
>>>                     XSLTTransformer transformer = new XSLTTransformer(
>>>                             xslSource, new Date().getTime());
>>>                     // pass all parameter to the xslTransformer
>>>             transformer.setParameters(parameters);
>>>             this.addComponent(transformer);
>>>             this.addComponent(TextSerializer.createPlainSerializer());
>>>             super.setup(outputStream, parameters);
>>>             where input is:
>>>             <?xml version="1.0" encoding="UTF-8"?>
>>>             <angebot>
>>>               <id>$name$$angebot.id <http://angebot.id>$</id>
>>>              <anganz>$angebot.anganz$</anganz>
>>>             <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>>>             </angebot>
>>>             xsl is the identity
>>>             angebot is a Hibernate Bean.
>>>             how do feed the pipeline with this Bean that it is used 
>>>             by Jexl to resolve the input String.
>>>
>>>
>>>             Am 13.03.2014 12:55, schrieb gelo1234:
>>>>             With servlet-sitemaps Jexl can be used within any
>>>>             pipeline as {jexl:.....} value.
>>>>
>>>>             Please show example of your embedded pipeline ?
>>>>
>>>>             Greetings,
>>>>             Greg
>>>>
>>>>
>>>>             2014-03-13 11:09 GMT+01:00 Yahoo
>>>>             <hansheinrichbraun@yahoo.de
>>>>             <ma...@yahoo.de>>:
>>>>
>>>>                 How can I use Jexl in an embadded Pipline ?
>>>>
>>>>                 ---------------------------------------------------------------------
>>>>                 To unsubscribe, e-mail:
>>>>                 users-unsubscribe@cocoon.apache.org
>>>>                 <ma...@cocoon.apache.org>
>>>>                 For additional commands, e-mail:
>>>>                 users-help@cocoon.apache.org
>>>>                 <ma...@cocoon.apache.org>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: calling a sitemap-snippet from within a program

Posted by gelo1234 <ge...@gmail.com>.
Hi,

1. Yes, it's possible. Since all sitemap matching URL's are actually kind
of HTTP Servlets, you can just use any http client (e.g. Apache HttpClient)
to invoke the servlet and get the response (if that is outside Cocoon):

HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://www.test.com/servlet.xml");
HttpResponse response = client.execute(request);
*// Get the response*
BufferedReader rd = new BufferedReader
  (new InputStreamReader(response.getEntity().getContent()));

String line = "";while ((line = rd.readLine()) != null) {
  ...
}


2. You can invoke any sitemap-servlet from within cocoon pipeline of course:
http://wiki.apache.org/cocoon/IntegrateAServlet

3. If you want to invoke sitemap-servlet from Cocoon API, first you need to
decide at which step that action need to be taken. If it's a Starter, you
can use XMLGenerator with given URL:

URL base = this.getClass().getResource("http://www.test.com/");
Pipeline<SAXPipelineComponent> pipeline = new
NonCachingPipeline<SAXPipelineComponent>();
pipeline.addComponent(new XMLGenerator(new URL(base, "servlet.xml")));


If it's somewhere in the middle of the pipeline, you can use
IncludeTransformer that will call your servlet-service:

pipeline.addComponent(new XIncludeTransformer("servlet_calling_include.xml"));


where:

servlet_calling_include.xml


<data_from_servlet><i:include
src="servlet:/data/servlet"/></data_from_servlet>


Hope that helps.

Greetings,
Greg



2014-03-21 9:14 GMT+01:00 Yahoo <ha...@yahoo.de>:

>
> Hello Greg,
>
> is it possible  to call a sitemap-snippet within a program an getting the
> respone inside a program?
>
> H.Braun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

calling a sitemap-snippet from within a program

Posted by Yahoo <ha...@yahoo.de>.
Hello Greg,

is it possible  to call a sitemap-snippet within a program an getting 
the respone inside a program?

H.Braun

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Jexl in embedded Pipeline

Posted by Yahoo <ha...@yahoo.de>.
You are right. The only reason I didn't leave Cocoon is its automatic 
production of pdf from xml.
The surrounding became very tediously.
I just found out that there is some difference between Jexl and Velocity 
expressions.
But I think I can now try to upgrade my former cocoon email adaption.

Am 14.03.2014 08:25, schrieb gelo1234:
> Cocoon 3 pipelines are either SAX or StAX events based so they operate 
> upon xml data. If you could feed XML into another pipeline component 
> that's fine. Just ask yourself if you really need Cocoon for the task 
> you are trying to complete.
>
> Greetings,
> Greg
>
>
> 2014-03-14 6:13 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de 
> <ma...@yahoo.de>>:
>
>     I found what I want todo. It's not  Jexl it's the VelocityEngine I
>     need.
>     Here is the example from spring mail.
>
>         MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
>                  message.setTo(user.getEmailAddress());
>                  message.setFrom("webmaster@csonth.gov.uk"  <ma...@csonth.gov.uk>);/// could be parameterized.../
>                  Map model = new HashMap();
>                  model.put("user", user);
>                  String text = VelocityEngineUtils.mergeTemplateIntoString(
>                     velocityEngine, "com/dns/registration-confirmation.vm", model);
>                  message.setText(text, true);
>
>
>     In my case the text comes from an inline Cocoon Pipeline.
>     I could first import the template use the Velocity Engine and then
>     give it to the Pipeline.
>     or is there possibility to make the job done by the pipeline .
>
>     Am 13.03.2014 19:34, schrieb gelo1234:
>>     I don't know about the attachments but a clean Cocoon3 extension
>>     for sending emails you can find here:
>>
>>     https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java
>>
>>     Greetings,
>>     Greg
>>
>>
>>     2014-03-13 15:02 GMT+01:00 Piratenvisier
>>     <hansheinrichbraun@yahoo.de <ma...@yahoo.de>>:
>>
>>         An application like this I use already.
>>         Thorsten Scherler made this email Application for me.
>>         The important point: I want to send an email and the Email
>>         Text and the attachements are produced by cocoon pipelines.
>>         This a an important part of my cocoon 2.10 application which
>>         I wanted to transfer to 3.0
>>
>>         Am 13.03.2014 14:23, schrieb gelo1234:
>>>         I got lost with your explanation :) It's a kind of awkward
>>>         thing to me that you are actually trying to do with that code.
>>>
>>>
>>>         Why not making it clean:
>>>
>>>         1. First you need a String-Template match to serialize the
>>>         Hibernate bean -> output XML with final values
>>>
>>>         <map:match  pattern="hibernate/bean">
>>>                  <map:generate  src="bean.xml"  type="stringtemplate"  />
>>>                  <map:serialize  type="xml"  />
>>>         </map:match>
>>>         where bean.xml is your [input]
>>>
>>>         You can now feed angebot bean data into hibernate/bean pipe
>>>         above (to get it serialized):
>>>         <map:match  pattern="hibernate/{id}">
>>>                  <controller:call  controller="rest-controller"  select="BeanController">
>>>                    <map:parameter  name="id"  value="{map:id}"  />
>>>                  </controller:call>
>>>         </map:match>
>>>
>>>
>>>         @RESTController
>>>         public  class  BeanController  implements  Get  {
>>>
>>>              @SitemapParameter
>>>              private  String  id;
>>>
>>>              @RequestParameter
>>>              private  String  name;
>>>            
>>>              // through injection or other way
>>>
>>>              HibernateDAO dao;
>>>
>>>               public  RestResponse  doGet()  throws  Exception  {
>>>                  Map<String,  Object>  data=  new  HashMap<String,  Object>();
>>>                  data.put("angebot",  dao.getAngebotBean(id));
>>>                  data.put("name",  this.name);
>>>
>>>                  return  new  Page("servlet:/hibernate/bean",  data);
>>>              }
>>>         }
>>>         At this point you got your Hibernate bean serialized (into
>>>         XML data).
>>>
>>>         2. Second you can go for XSLT Transformer and transform XML
>>>         into anything you want
>>>
>>>         You don't need any JEXL here.
>>>
>>>
>>>         Greetings,
>>>         Greg
>>>
>>>
>>>
>>>
>>>         2014-03-13 13:30 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>>         <ma...@yahoo.de>>:
>>>
>>>             I used the EmailPlainPipe from the distribution:
>>>               byte[] bytes = (byte[]) parameters.get("input");
>>>                     XMLGenerator generator = new XMLGenerator(bytes);
>>>             this.addComponent(generator);
>>>                     byte[] xsl = (byte[]) parameters.get("xsl");
>>>                     Source xslSource = new StreamSource(new
>>>             ByteArrayInputStream(xsl));
>>>                     XSLTTransformer transformer = new XSLTTransformer(
>>>                             xslSource, new Date().getTime());
>>>                     // pass all parameter to the xslTransformer
>>>             transformer.setParameters(parameters);
>>>             this.addComponent(transformer);
>>>             this.addComponent(TextSerializer.createPlainSerializer());
>>>             super.setup(outputStream, parameters);
>>>             where input is:
>>>             <?xml version="1.0" encoding="UTF-8"?>
>>>             <angebot>
>>>               <id>$name$$angebot.id <http://angebot.id>$</id>
>>>              <anganz>$angebot.anganz$</anganz>
>>>             <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>>>             </angebot>
>>>             xsl is the identity
>>>             angebot is a Hibernate Bean.
>>>             how do feed the pipeline with this Bean that it is used 
>>>             by Jexl to resolve the input String.
>>>
>>>
>>>             Am 13.03.2014 12:55, schrieb gelo1234:
>>>>             With servlet-sitemaps Jexl can be used within any
>>>>             pipeline as {jexl:.....} value.
>>>>
>>>>             Please show example of your embedded pipeline ?
>>>>
>>>>             Greetings,
>>>>             Greg
>>>>
>>>>
>>>>             2014-03-13 11:09 GMT+01:00 Yahoo
>>>>             <hansheinrichbraun@yahoo.de
>>>>             <ma...@yahoo.de>>:
>>>>
>>>>                 How can I use Jexl in an embadded Pipline ?
>>>>
>>>>                 ---------------------------------------------------------------------
>>>>                 To unsubscribe, e-mail:
>>>>                 users-unsubscribe@cocoon.apache.org
>>>>                 <ma...@cocoon.apache.org>
>>>>                 For additional commands, e-mail:
>>>>                 users-help@cocoon.apache.org
>>>>                 <ma...@cocoon.apache.org>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: Jexl in embedded Pipeline

Posted by gelo1234 <ge...@gmail.com>.
Cocoon 3 pipelines are either SAX or StAX events based so they operate upon
xml data. If you could feed XML into another pipeline component that's
fine. Just ask yourself if you really need Cocoon for the task you are
trying to complete.

Greetings,
Greg


2014-03-14 6:13 GMT+01:00 Yahoo <ha...@yahoo.de>:

>  I found what I want todo. It's not  Jexl it's the VelocityEngine I need.
> Here is the example from spring mail.
>
>    MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
>             message.setTo(user.getEmailAddress());
>             message.setFrom("webmaster@csonth.gov.uk" <we...@csonth.gov.uk>); *// could be parameterized...*
>             Map model = new HashMap();
>             model.put("user", user);
>             String text = VelocityEngineUtils.mergeTemplateIntoString(
>                velocityEngine, "com/dns/registration-confirmation.vm", model);
>             message.setText(text, true);
>
>
> In my case the text comes from an inline Cocoon Pipeline.
> I could first import the template use the Velocity Engine and then give it
> to the Pipeline.
> or is there possibility to make the job done by the pipeline .
>
> Am 13.03.2014 19:34, schrieb gelo1234:
>
>  I don't know about the attachments but a clean Cocoon3 extension for
> sending emails you can find here:
>
>
> https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java
>
>  Greetings,
> Greg
>
>
> 2014-03-13 15:02 GMT+01:00 Piratenvisier <ha...@yahoo.de>:
>
>>  An application like this I use already.
>> Thorsten Scherler made this email Application for me.
>> The important point: I want to send an email and the Email Text and the
>> attachements are produced by cocoon pipelines.
>> This a an important part of my cocoon 2.10 application which I wanted to
>> transfer to 3.0
>>
>> Am 13.03.2014 14:23, schrieb gelo1234:
>>
>>  I got lost with your explanation :) It's a kind of awkward thing to me
>> that you are actually trying to do with that code.
>>
>>
>>  Why not making it clean:
>>
>>  1. First you need a String-Template match to serialize the Hibernate
>> bean -> output XML with final values
>>
>> <map:match pattern="hibernate/bean">
>>         <map:generate src="bean.xml" type="stringtemplate" />
>>         <map:serialize type="xml" /></map:match>
>>
>> where bean.xml is your [input]
>>
>>  You can now feed angebot bean data into hibernate/bean pipe above (to
>> get it serialized):
>>
>> <map:match pattern="hibernate/{id}">
>>         <controller:call controller="rest-controller" select="BeanController">
>>           <map:parameter name="id" value="{map:id}" />
>>         </controller:call></map:match>
>>
>> @RESTControllerpublic class BeanController implements Get {
>>
>>     @SitemapParameter
>>     private String id;
>>
>>     @RequestParameter
>>     private String name;
>>
>>
>>     // through injection or other way
>>
>>     HibernateDAO dao;
>>
>>
>>     public RestResponse doGet() throws Exception {
>>         Map<String, Object> data = new HashMap<String, Object>();
>>         data.put("angebot", dao.getAngebotBean(id));
>>         data.put("name", this.name);
>>
>>         return new Page("servlet:/hibernate/bean", data);
>>     }}
>>
>>  At this point you got your Hibernate bean serialized (into XML data).
>>
>>  2. Second you can go for XSLT Transformer and transform XML into
>> anything you want
>>
>>  You don't need any JEXL here.
>>
>>
>>  Greetings,
>> Greg
>>
>>
>>
>>
>>  2014-03-13 13:30 GMT+01:00 Yahoo <ha...@yahoo.de>:
>>
>>>  I used the EmailPlainPipe from the distribution:
>>>   byte[] bytes = (byte[]) parameters.get("input");
>>>         XMLGenerator generator = new XMLGenerator(bytes);
>>>         this.addComponent(generator);
>>>         byte[] xsl = (byte[]) parameters.get("xsl");
>>>         Source xslSource = new StreamSource(new
>>> ByteArrayInputStream(xsl));
>>>         XSLTTransformer transformer = new XSLTTransformer(
>>>                 xslSource, new Date().getTime());
>>>         // pass all parameter to the xslTransformer
>>>         transformer.setParameters(parameters);
>>>         this.addComponent(transformer);
>>>         this.addComponent(TextSerializer.createPlainSerializer());
>>>         super.setup(outputStream, parameters);
>>> where input is:
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <angebot>
>>>   <id>$name$$angebot.id$</id>
>>>  <anganz>$angebot.anganz$</anganz>
>>> <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>>> </angebot>
>>> xsl is the identity
>>> angebot is a Hibernate Bean.
>>> how do feed the pipeline with this Bean that it is used  by Jexl to
>>> resolve the input String.
>>>
>>>
>>> Am 13.03.2014 12:55, schrieb gelo1234:
>>>
>>>  With servlet-sitemaps Jexl can be used within any pipeline as
>>> {jexl:.....} value.
>>>
>>>  Please show example of your embedded pipeline ?
>>>
>>>  Greetings,
>>> Greg
>>>
>>>
>>> 2014-03-13 11:09 GMT+01:00 Yahoo <ha...@yahoo.de>:
>>>
>>>> How can I use Jexl in an embadded Pipline ?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Re: Jexl in embedded Pipeline

Posted by Yahoo <ha...@yahoo.de>.
I found what I want todo. It's not  Jexl it's the VelocityEngine I need.
Here is the example from spring mail.

    MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
             message.setTo(user.getEmailAddress());
             message.setFrom("webmaster@csonth.gov.uk");/// could be parameterized.../
             Map model = new HashMap();
             model.put("user", user);
             String text = VelocityEngineUtils.mergeTemplateIntoString(
                velocityEngine, "com/dns/registration-confirmation.vm", model);
             message.setText(text, true);


In my case the text comes from an inline Cocoon Pipeline.
I could first import the template use the Velocity Engine and then give 
it to the Pipeline.
or is there possibility to make the job done by the pipeline .

Am 13.03.2014 19:34, schrieb gelo1234:
> I don't know about the attachments but a clean Cocoon3 extension for 
> sending emails you can find here:
>
> https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java
>
> Greetings,
> Greg
>
>
> 2014-03-13 15:02 GMT+01:00 Piratenvisier <hansheinrichbraun@yahoo.de 
> <ma...@yahoo.de>>:
>
>     An application like this I use already.
>     Thorsten Scherler made this email Application for me.
>     The important point: I want to send an email and the Email Text
>     and the attachements are produced by cocoon pipelines.
>     This a an important part of my cocoon 2.10 application which I
>     wanted to transfer to 3.0
>
>     Am 13.03.2014 14:23, schrieb gelo1234:
>>     I got lost with your explanation :) It's a kind of awkward thing
>>     to me that you are actually trying to do with that code.
>>
>>
>>     Why not making it clean:
>>
>>     1. First you need a String-Template match to serialize the
>>     Hibernate bean -> output XML with final values
>>
>>     <map:match  pattern="hibernate/bean">
>>              <map:generate  src="bean.xml"  type="stringtemplate"  />
>>              <map:serialize  type="xml"  />
>>     </map:match>
>>     where bean.xml is your [input]
>>
>>     You can now feed angebot bean data into hibernate/bean pipe above
>>     (to get it serialized):
>>     <map:match  pattern="hibernate/{id}">
>>              <controller:call  controller="rest-controller"  select="BeanController">
>>                <map:parameter  name="id"  value="{map:id}"  />
>>              </controller:call>
>>     </map:match>
>>
>>
>>     @RESTController
>>     public  class  BeanController  implements  Get  {
>>
>>          @SitemapParameter
>>          private  String  id;
>>
>>          @RequestParameter
>>          private  String  name;
>>        
>>          // through injection or other way
>>
>>          HibernateDAO dao;
>>
>>           public  RestResponse  doGet()  throws  Exception  {
>>              Map<String,  Object>  data=  new  HashMap<String,  Object>();
>>              data.put("angebot",  dao.getAngebotBean(id));
>>              data.put("name",  this.name);
>>
>>              return  new  Page("servlet:/hibernate/bean",  data);
>>          }
>>     }
>>     At this point you got your Hibernate bean serialized (into XML data).
>>
>>     2. Second you can go for XSLT Transformer and transform XML into
>>     anything you want
>>
>>     You don't need any JEXL here.
>>
>>
>>     Greetings,
>>     Greg
>>
>>
>>
>>
>>     2014-03-13 13:30 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>     <ma...@yahoo.de>>:
>>
>>         I used the EmailPlainPipe from the distribution:
>>           byte[] bytes = (byte[]) parameters.get("input");
>>                 XMLGenerator generator = new XMLGenerator(bytes);
>>                 this.addComponent(generator);
>>                 byte[] xsl = (byte[]) parameters.get("xsl");
>>                 Source xslSource = new StreamSource(new
>>         ByteArrayInputStream(xsl));
>>                 XSLTTransformer transformer = new XSLTTransformer(
>>                         xslSource, new Date().getTime());
>>                 // pass all parameter to the xslTransformer
>>         transformer.setParameters(parameters);
>>                 this.addComponent(transformer);
>>         this.addComponent(TextSerializer.createPlainSerializer());
>>                 super.setup(outputStream, parameters);
>>         where input is:
>>         <?xml version="1.0" encoding="UTF-8"?>
>>         <angebot>
>>           <id>$name$$angebot.id <http://angebot.id>$</id>
>>          <anganz>$angebot.anganz$</anganz>
>>         <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>>         </angebot>
>>         xsl is the identity
>>         angebot is a Hibernate Bean.
>>         how do feed the pipeline with this Bean that it is used  by
>>         Jexl to resolve the input String.
>>
>>
>>         Am 13.03.2014 12:55, schrieb gelo1234:
>>>         With servlet-sitemaps Jexl can be used within any pipeline
>>>         as {jexl:.....} value.
>>>
>>>         Please show example of your embedded pipeline ?
>>>
>>>         Greetings,
>>>         Greg
>>>
>>>
>>>         2014-03-13 11:09 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>>         <ma...@yahoo.de>>:
>>>
>>>             How can I use Jexl in an embadded Pipline ?
>>>
>>>             ---------------------------------------------------------------------
>>>             To unsubscribe, e-mail:
>>>             users-unsubscribe@cocoon.apache.org
>>>             <ma...@cocoon.apache.org>
>>>             For additional commands, e-mail:
>>>             users-help@cocoon.apache.org
>>>             <ma...@cocoon.apache.org>
>>>
>>>
>>
>>
>
>


Re: Jexl in embedded Pipeline

Posted by gelo1234 <ge...@gmail.com>.
I don't know about the attachments but a clean Cocoon3 extension for
sending emails you can find here:

https://github.com/alveolo/butterfly/blob/master/cocoon/src/test/java/org/alveolo/butterfly/test/cocoon/email/MailSerializerTest.java

Greetings,
Greg


2014-03-13 15:02 GMT+01:00 Piratenvisier <ha...@yahoo.de>:

>  An application like this I use already.
> Thorsten Scherler made this email Application for me.
> The important point: I want to send an email and the Email Text and the
> attachements are produced by cocoon pipelines.
> This a an important part of my cocoon 2.10 application which I wanted to
> transfer to 3.0
>
> Am 13.03.2014 14:23, schrieb gelo1234:
>
>  I got lost with your explanation :) It's a kind of awkward thing to me
> that you are actually trying to do with that code.
>
>
>  Why not making it clean:
>
>  1. First you need a String-Template match to serialize the Hibernate
> bean -> output XML with final values
>
> <map:match pattern="hibernate/bean">
>         <map:generate src="bean.xml" type="stringtemplate" />
>         <map:serialize type="xml" /></map:match>
>
> where bean.xml is your [input]
>
>  You can now feed angebot bean data into hibernate/bean pipe above (to
> get it serialized):
>
> <map:match pattern="hibernate/{id}">
>         <controller:call controller="rest-controller" select="BeanController">
>           <map:parameter name="id" value="{map:id}" />
>         </controller:call></map:match>
>
> @RESTControllerpublic class BeanController implements Get {
>
>     @SitemapParameter
>     private String id;
>
>     @RequestParameter
>     private String name;
>
>
>     // through injection or other way
>
>     HibernateDAO dao;
>
>
>     public RestResponse doGet() throws Exception {
>         Map<String, Object> data = new HashMap<String, Object>();
>         data.put("angebot", dao.getAngebotBean(id));
>         data.put("name", this.name);
>
>         return new Page("servlet:/hibernate/bean", data);
>     }}
>
>  At this point you got your Hibernate bean serialized (into XML data).
>
>  2. Second you can go for XSLT Transformer and transform XML into
> anything you want
>
>  You don't need any JEXL here.
>
>
>  Greetings,
> Greg
>
>
>
>
>  2014-03-13 13:30 GMT+01:00 Yahoo <ha...@yahoo.de>:
>
>>  I used the EmailPlainPipe from the distribution:
>>   byte[] bytes = (byte[]) parameters.get("input");
>>         XMLGenerator generator = new XMLGenerator(bytes);
>>         this.addComponent(generator);
>>         byte[] xsl = (byte[]) parameters.get("xsl");
>>         Source xslSource = new StreamSource(new
>> ByteArrayInputStream(xsl));
>>         XSLTTransformer transformer = new XSLTTransformer(
>>                 xslSource, new Date().getTime());
>>         // pass all parameter to the xslTransformer
>>         transformer.setParameters(parameters);
>>         this.addComponent(transformer);
>>         this.addComponent(TextSerializer.createPlainSerializer());
>>         super.setup(outputStream, parameters);
>> where input is:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <angebot>
>>   <id>$name$$angebot.id$</id>
>>  <anganz>$angebot.anganz$</anganz>
>> <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>> </angebot>
>> xsl is the identity
>> angebot is a Hibernate Bean.
>> how do feed the pipeline with this Bean that it is used  by Jexl to
>> resolve the input String.
>>
>>
>> Am 13.03.2014 12:55, schrieb gelo1234:
>>
>>  With servlet-sitemaps Jexl can be used within any pipeline as
>> {jexl:.....} value.
>>
>>  Please show example of your embedded pipeline ?
>>
>>  Greetings,
>> Greg
>>
>>
>> 2014-03-13 11:09 GMT+01:00 Yahoo <ha...@yahoo.de>:
>>
>>> How can I use Jexl in an embadded Pipline ?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>>
>
>

Re: Jexl in embedded Pipeline

Posted by Piratenvisier <ha...@yahoo.de>.
An application like this I use already.
Thorsten Scherler made this email Application for me.
The important point: I want to send an email and the Email Text and the 
attachements are produced by cocoon pipelines.
This a an important part of my cocoon 2.10 application which I wanted to 
transfer to 3.0

Am 13.03.2014 14:23, schrieb gelo1234:
> I got lost with your explanation :) It's a kind of awkward thing to me 
> that you are actually trying to do with that code.
>
>
> Why not making it clean:
>
> 1. First you need a String-Template match to serialize the Hibernate 
> bean -> output XML with final values
>
> <map:match  pattern="hibernate/bean">
>          <map:generate  src="bean.xml"  type="stringtemplate"  />
>          <map:serialize  type="xml"  />
> </map:match>
> where bean.xml is your [input]
>
> You can now feed angebot bean data into hibernate/bean pipe above (to 
> get it serialized):
> <map:match  pattern="hibernate/{id}">
>          <controller:call  controller="rest-controller"  select="BeanController">
>            <map:parameter  name="id"  value="{map:id}"  />
>          </controller:call>
> </map:match>
>
>
> @RESTController
> public  class  BeanController  implements  Get  {
>
>      @SitemapParameter
>      private  String  id;
>
>      @RequestParameter
>      private  String  name;
>    
>      // through injection or other way
>
>      HibernateDAO dao;
>
>       public  RestResponse  doGet()  throws  Exception  {
>          Map<String,  Object>  data=  new  HashMap<String,  Object>();
>          data.put("angebot",  dao.getAngebotBean(id));
>          data.put("name",  this.name);
>
>          return  new  Page("servlet:/hibernate/bean",  data);
>      }
> }
> At this point you got your Hibernate bean serialized (into XML data).
>
> 2. Second you can go for XSLT Transformer and transform XML into 
> anything you want
>
> You don't need any JEXL here.
>
>
> Greetings,
> Greg
>
>
>
>
> 2014-03-13 13:30 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de 
> <ma...@yahoo.de>>:
>
>     I used the EmailPlainPipe from the distribution:
>       byte[] bytes = (byte[]) parameters.get("input");
>             XMLGenerator generator = new XMLGenerator(bytes);
>             this.addComponent(generator);
>             byte[] xsl = (byte[]) parameters.get("xsl");
>             Source xslSource = new StreamSource(new
>     ByteArrayInputStream(xsl));
>             XSLTTransformer transformer = new XSLTTransformer(
>                     xslSource, new Date().getTime());
>             // pass all parameter to the xslTransformer
>             transformer.setParameters(parameters);
>             this.addComponent(transformer);
>     this.addComponent(TextSerializer.createPlainSerializer());
>             super.setup(outputStream, parameters);
>     where input is:
>     <?xml version="1.0" encoding="UTF-8"?>
>     <angebot>
>       <id>$name$$angebot.id <http://angebot.id>$</id>
>      <anganz>$angebot.anganz$</anganz>
>     <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
>     </angebot>
>     xsl is the identity
>     angebot is a Hibernate Bean.
>     how do feed the pipeline with this Bean that it is used by Jexl to
>     resolve the input String.
>
>
>     Am 13.03.2014 12:55, schrieb gelo1234:
>>     With servlet-sitemaps Jexl can be used within any pipeline as
>>     {jexl:.....} value.
>>
>>     Please show example of your embedded pipeline ?
>>
>>     Greetings,
>>     Greg
>>
>>
>>     2014-03-13 11:09 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de
>>     <ma...@yahoo.de>>:
>>
>>         How can I use Jexl in an embadded Pipline ?
>>
>>         ---------------------------------------------------------------------
>>         To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>         <ma...@cocoon.apache.org>
>>         For additional commands, e-mail: users-help@cocoon.apache.org
>>         <ma...@cocoon.apache.org>
>>
>>
>
>


Re: Jexl in embedded Pipeline

Posted by gelo1234 <ge...@gmail.com>.
I got lost with your explanation :) It's a kind of awkward thing to me that
you are actually trying to do with that code.


Why not making it clean:

1. First you need a String-Template match to serialize the Hibernate bean
-> output XML with final values

<map:match pattern="hibernate/bean">
        <map:generate src="bean.xml" type="stringtemplate" />
        <map:serialize type="xml" /></map:match>

where bean.xml is your [input]

You can now feed angebot bean data into hibernate/bean pipe above (to get
it serialized):

<map:match pattern="hibernate/{id}">
        <controller:call controller="rest-controller" select="BeanController">
          <map:parameter name="id" value="{map:id}" />
        </controller:call></map:match>


@RESTControllerpublic class BeanController implements Get {

    @SitemapParameter
    private String id;

    @RequestParameter
    private String name;

    // through injection or other way
    HibernateDAO dao;


    public RestResponse doGet() throws Exception {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("angebot", dao.getAngebotBean(id));
        data.put("name", this.name);

        return new Page("servlet:/hibernate/bean", data);
    }}

At this point you got your Hibernate bean serialized (into XML data).

2. Second you can go for XSLT Transformer and transform XML into anything
you want

You don't need any JEXL here.


Greetings,
Greg




2014-03-13 13:30 GMT+01:00 Yahoo <ha...@yahoo.de>:

>  I used the EmailPlainPipe from the distribution:
>   byte[] bytes = (byte[]) parameters.get("input");
>         XMLGenerator generator = new XMLGenerator(bytes);
>         this.addComponent(generator);
>         byte[] xsl = (byte[]) parameters.get("xsl");
>         Source xslSource = new StreamSource(new ByteArrayInputStream(xsl));
>         XSLTTransformer transformer = new XSLTTransformer(
>                 xslSource, new Date().getTime());
>         // pass all parameter to the xslTransformer
>         transformer.setParameters(parameters);
>         this.addComponent(transformer);
>         this.addComponent(TextSerializer.createPlainSerializer());
>         super.setup(outputStream, parameters);
> where input is:
> <?xml version="1.0" encoding="UTF-8"?>
> <angebot>
>   <id>$name$$angebot.id$</id>
>  <anganz>$angebot.anganz$</anganz>
> <angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
> </angebot>
> xsl is the identity
> angebot is a Hibernate Bean.
> how do feed the pipeline with this Bean that it is used  by Jexl to
> resolve the input String.
>
>
> Am 13.03.2014 12:55, schrieb gelo1234:
>
>  With servlet-sitemaps Jexl can be used within any pipeline as
> {jexl:.....} value.
>
>  Please show example of your embedded pipeline ?
>
>  Greetings,
> Greg
>
>
> 2014-03-13 11:09 GMT+01:00 Yahoo <ha...@yahoo.de>:
>
>> How can I use Jexl in an embadded Pipline ?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>

Re: Jexl in embedded Pipeline

Posted by Yahoo <ha...@yahoo.de>.
I used the EmailPlainPipe from the distribution:
   byte[] bytes = (byte[]) parameters.get("input");
         XMLGenerator generator = new XMLGenerator(bytes);
         this.addComponent(generator);
         byte[] xsl = (byte[]) parameters.get("xsl");
         Source xslSource = new StreamSource(new ByteArrayInputStream(xsl));
         XSLTTransformer transformer = new XSLTTransformer(
                 xslSource, new Date().getTime());
         // pass all parameter to the xslTransformer
         transformer.setParameters(parameters);
         this.addComponent(transformer);
         this.addComponent(TextSerializer.createPlainSerializer());
         super.setup(outputStream, parameters);
where input is:
<?xml version="1.0" encoding="UTF-8"?>
<angebot>
   <id>$name$$angebot.id$</id>
  <anganz>$angebot.anganz$</anganz>
<angkurzbeschreibung>$angebot.angkurzbeschreibung$</angkurzbeschreibung>
</angebot>
xsl is the identity
angebot is a Hibernate Bean.
how do feed the pipeline with this Bean that it is used  by Jexl to 
resolve the input String.


Am 13.03.2014 12:55, schrieb gelo1234:
> With servlet-sitemaps Jexl can be used within any pipeline as 
> {jexl:.....} value.
>
> Please show example of your embedded pipeline ?
>
> Greetings,
> Greg
>
>
> 2014-03-13 11:09 GMT+01:00 Yahoo <hansheinrichbraun@yahoo.de 
> <ma...@yahoo.de>>:
>
>     How can I use Jexl in an embadded Pipline ?
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>     For additional commands, e-mail: users-help@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>
>


Re: Jexl in embedded Pipeline

Posted by gelo1234 <ge...@gmail.com>.
With servlet-sitemaps Jexl can be used within any pipeline as {jexl:.....}
value.

Please show example of your embedded pipeline ?

Greetings,
Greg


2014-03-13 11:09 GMT+01:00 Yahoo <ha...@yahoo.de>:

> How can I use Jexl in an embadded Pipline ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Jexl in embedded Pipeline

Posted by Yahoo <ha...@yahoo.de>.
How can I use Jexl in an embadded Pipline ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by Yahoo <ha...@yahoo.de>.
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 
> <ma...@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
>>     <ma...@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
>>         <ma...@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
>>             <ma...@cocoon.apache.org>
>>             For additional commands, e-mail:
>>             users-help@cocoon.apache.org
>>             <ma...@cocoon.apache.org>
>>
>>
>>
>
>


Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by gelo1234 <ge...@gmail.com>.
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 <ha...@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 <ge...@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 <ha...@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
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>
>

Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by Yahoo <ha...@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 
> <ma...@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
>     <ma...@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
>         <ma...@cocoon.apache.org>
>         For additional commands, e-mail: users-help@cocoon.apache.org
>         <ma...@cocoon.apache.org>
>
>
>


Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by gelo1234 <ge...@gmail.com>.
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 <ge...@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 <ha...@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
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>

Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by gelo1234 <ge...@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 <ha...@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
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by Yahoo <ha...@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
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Feeding a Bean to the pipeline

Posted by gelo1234 <ge...@gmail.com>.
Why JAXB/annotations didn't work ? Open-session problem ?


Greetings,
Greg

2014-03-12 12:14 GMT+01:00 Piratenvisier <ha...@yahoo.de>:

> I have to feed the Pipeline with the content of a Hibernate Bean.
> I tried with JAXB and and annotations. But I could not get the preferred
> result.
> Now I will try the XMLGenerator.
> Is there another possibility.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Feeding a Bean to the pipeline

Posted by Piratenvisier <ha...@yahoo.de>.
I have to feed the Pipeline with the content of a Hibernate Bean.
I tried with JAXB and and annotations. But I could not get the preferred 
result.
Now I will try the XMLGenerator.
Is there another possibility.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: URLResponse from Restcontroller with Hibernate circular relationships

Posted by Francesco Chicchiriccò <il...@apache.org>.
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.

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PPMC
http://people.apache.org/~ilgrosso/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org