Hi Without to much digging into this the LazyInitializationException smells like some Hibernate stuff not having loaded all the objects needed.
You haven't posted your configuration how you wire up the TX manager. But Camel is using Spring behind the covers to handle the TX so whatever works with Spring should work with Camel, so to speak. What is the originator of the request? It looks like you have webservice as the "from". You must remeber not all transport types support transaction. Most commonly it's only JMS and JDBC. /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/ On Mon, Nov 17, 2008 at 3:55 PM, mcobery <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to create and use a Camel Transaction Oriented Endpoint (Camel > TOE) using Spring, Hibernate and have several questions. > > Can I use my Hibernate Session Factory and Transaction Manager to create a > transaction across the route? > If so, does anyone have an example of this set up? > > I have have tried several configurations including using Atomikos > Transaction Essentials but keep getting a LazyInitializationException. Here > is the route trace. I can see that the endpoint is a transaction since it > has the org.apache.camel.transacted property set to true. > > I have included the trace and the configuration below. > > Regards, > Marc > [INFO] [talledLocalContainer] [RULESTREAM] INFO [http-8081-1] > TraceInterceptor.process(87) | -> choice(exchange.in.headers.operationName > == 'checkin', exchange.in.headers.operationName == 'delete', > exchange.in.headers.operationName == 'findUsersWithRoleOnObject', > exchange.in.headers.operationName == 'find', > exchange.in.headers.operationName.startsWith('find'), > exchange.in.headers.operationName == 'lock', > exchange.in.headers.operationName == 'rollback', > exchange.in.headers.operationName == 'unlock', > exchange.in.headers.operationName == 'version') , Pattern:InOut , > Properties:{class > org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: > {http://core.rulestream.com/class}find], org.apache.camel.transacted=true} , > Headers:{content-length=1056, operationName=find, > content.type=text/xml;charset=UTF-8, host=localhost:8081, user-agent=Jakarta > Commons-HttpClient/3.0.1, > operationNameSpace=http://core.rulestream.com/class, > content-type=text/xml;charset=UTF-8, soapaction=""} , > Body:[EMAIL PROTECTED] > [talledLocalContainer] [RULESTREAM] INFO [http-8081-1] > TraceInterceptor.process(87) | -> to(bean:classBSO?methodName=find) , > Pattern:InOut , Properties:{class > org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: > {http://core.rulestream.com/class}find], org.apache.camel.transacted=true} , > Headers:{content-length=1056, operationName=find, > content.type=text/xml;charset=UTF-8, host=localhost:8081, user-agent=Jakarta > Commons-HttpClient/3.0.1, > operationNameSpace=http://core.rulestream.com/class, > content-type=text/xml;charset=UTF-8, soapaction=""} , > Body:[EMAIL PROTECTED] > [talledLocalContainer] [RULESTREAM] INFO [http-8081-1] > TraceInterceptor.process(87) | -> bean(ref: classLatestRevision method: > filter) , Pattern:InOut , Properties:{org.apache.camel.transacted=true, > class > org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: > {http://core.rulestream.com/class}find], > org.apache.camel.bean.BeanHolder=bean: classBSO} , > Headers:{content-length=1056, operationName=find, > content.type=text/xml;charset=UTF-8, host=localhost:8081, user-agent=Jakarta > Commons-HttpClient/3.0.1, > operationNameSpace=http://core.rulestream.com/class, > content-type=text/xml;charset=UTF-8, soapaction=""} , > Body:[EMAIL PROTECTED] > [talledLocalContainer] [RULESTREAM] INFO [http-8081-1] > TraceInterceptor.process(87) | -> bean(ref: objectMaterializer method: > materialize) , Pattern:InOut , Properties:{class > org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: > {http://core.rulestream.com/class}find], org.apache.camel.transacted=true, > org.apache.camel.bean.BeanHolder=bean: classLatestRevision} , > Body:[EMAIL PROTECTED] > [talledLocalContainer] [RULESTREAM] ERROR [http-8081-1] > LazyInitializationException.<init>(19) | failed to lazily initialize a > collection of role: > com.rulestream.core.knowledge.persistence.ClassDTO.compositeSpecs, no > session or session was closed[INFO] [talledLocalContainer] > org.hibernate.LazyInitializationException: failed to lazily initialize a > collection of role: > com.rulestream.core.knowledge.persistence.ClassDTO.compositeSpecs, no > session or session was closed[INFO] [talledLocalContainer] at > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358) > > My spring configuration for the route: > <camel:camelContext id="camel.context" trace="true" > errorHandlerRef="cxfDeadLetterErrorHandler"> > <camel:jmxAgent id="agent" disabled="true"/> > <camel:route> > <camel:from uri="cxf://bean:classService" /> > <camel:policy ref="PROPAGATION_REQUIRED"/> > <camel:choice> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'checkin'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=checkin" /> > <camel:process ref="booleanProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'delete'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=delete" /> > <camel:process ref="booleanProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'findUsersWithRoleOnObject'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=findUsersWithRoleOnObject" > /> > <camel:process ref="stringListProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'find'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=find" /> > <camel:bean ref="classLatestRevision" method="filter"/> > <camel:bean ref="objectMaterializer" method="materialize"/> > <camel:process ref="classListProcessor" /> > </camel:when> > <camel:when> > > <camel:groovy>exchange.in.headers.operationName.startsWith('find')</camel:groovy> > <camel:recipientList> > <camel:groovy> > 'bean:classBSO?methodName='+exchange.in.headers.operationName > </camel:groovy> > </camel:recipientList> > <camel:process ref="classListProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'lock'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=lock" /> > <camel:process ref="booleanProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'rollback'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=rollback" /> > <camel:process ref="booleanProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'unlock'</camel:groovy> > <camel:to uri="bean:classBSO?methodName=unlock" /> > <camel:process ref="booleanProcessor" /> > </camel:when> > <camel:when> > <camel:groovy>exchange.in.headers.operationName == > 'version'</camel:groovy> > <camel:to uri="bean:classVersionBSO?methodName=create" /> > <camel:process ref="classProcessor" /> > </camel:when> > <camel:otherwise> > <camel:recipientList> > <camel:groovy> > 'bean:classBSO?methodName='+exchange.in.headers.operationName > </camel:groovy> > </camel:recipientList> > <camel:process ref="classProcessor" /> > </camel:otherwise> > </camel:choice> > <camel:to uri="bean:entityCacheClearingProcessor" /> > </camel:route> > </camel:camelContext> > > > > -- > View this message in context: > http://www.nabble.com/Camel-TOE-tp20540912s22882p20540912.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
