Drools doesn't handle Hibernate in anyway, we have no awareness of it. The exceptions indicates that you have lazy loading enabled for hibernate, but your session is disconnected when it tries to lazy load the object.

Mark
Heyns, Juan wrote:

Hi,

 

I am getting the following error with 4.0.1, I didn’t get this with 4.0.0… Has anything changed in the way Drools works with Hibernate.

 

Juan

 

15:24:52,281 ERROR LazyInitializationException:19 - failed to lazily initialize a collection, no session or session was closed

org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed

      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)

      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)

      at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:132)

      at org.hibernate.collection.PersistentSet.contains(PersistentSet.java:153)

      at org.drools.base.evaluators.ObjectFactory$ObjectContainsEvaluator.evaluateCachedLeft(ObjectFactory.java:481)

      at org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:72)

      at org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:72)

      at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:117)

      at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:119)

      at org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)

      at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:131)

      at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:20)

      at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:160)

      at org.drools.reteoo.Rete.assertObject(Rete.java:176)

      at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:196)

      at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)

      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:854)

      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:826)

      at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:60)

      at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:54)

      at com.lonmin.bns.domain.rules.Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0.consequence(Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0.java:35)

      at com.lonmin.bns.domain.rules.Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0ConsequenceInvoker.evaluate(Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0ConsequenceInvoker.java:22)

      at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)

      at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)

      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:434)

      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:396)

      at com.lonmin.bns.domain.rules.RulesEngine.calculateStopeDrillingBonus(RulesEngine.java:54)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.processDetail(StopeDrillingCardPersister.java:371)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.processCard(StopeDrillingCardPersister.java:276)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.process(StopeDrillingCardPersister.java:69)

      at com.lonmin.bns.domain.model.ValueObjectPersister.persist(ValueObjectPersister.java:38)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersisterTest.testEditStopeDrillingCard(StopeDrillingCardPersisterTest.java:182)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:324)

      at junit.framework.TestCase.runTest(TestCase.java:164)

      at junit.framework.TestCase.runBare(TestCase.java:130)

      at junit.framework.TestResult$1.protect(TestResult.java:106)

      at junit.framework.TestResult.runProtected(TestResult.java:124)

      at junit.framework.TestResult.run(TestResult.java:109)

      at junit.framework.TestCase.run(TestCase.java:120)

      at junit.framework.TestSuite.runTest(TestSuite.java:230)

      at junit.framework.TestSuite.run(TestSuite.java:225)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)

org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed

      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)

      at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)

      at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:132)

      at org.hibernate.collection.PersistentSet.contains(PersistentSet.java:153)

      at org.drools.base.evaluators.ObjectFactory$ObjectContainsEvaluator.evaluateCachedLeft(ObjectFactory.java:481)

      at org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:72)

      at org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:72)

      at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:117)

      at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:119)

      at org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)

      at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:131)

      at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:20)

      at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:160)

      at org.drools.reteoo.Rete.assertObject(Rete.java:176)

      at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:196)

      at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)

      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:854)

      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:826)

      at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:60)

      at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:54)

      at com.lonmin.bns.domain.rules.Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0.consequence(Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0.java:35)

      at com.lonmin.bns.domain.rules.Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0ConsequenceInvoker.evaluate(Rule_Stope_Drilling_work_is_evaluated_based_on_the_holes_drilled_and_blasts_0ConsequenceInvoker.java:22)

      at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)

      at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)

      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:434)

      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:396)

      at com.lonmin.bns.domain.rules.RulesEngine.calculateStopeDrillingBonus(RulesEngine.java:54)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.processDetail(StopeDrillingCardPersister.java:371)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.processCard(StopeDrillingCardPersister.java:276)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersister.process(StopeDrillingCardPersister.java:69)

      at com.lonmin.bns.domain.model.ValueObjectPersister.persist(ValueObjectPersister.java:38)

      at com.lonmin.bns.domain.model.StopeDrillingCardPersisterTest.testEditStopeDrillingCard(StopeDrillingCardPersisterTest.java:182)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:324)

      at junit.framework.TestCase.runTest(TestCase.java:164)

      at junit.framework.TestCase.runBare(TestCase.java:130)

      at junit.framework.TestResult$1.protect(TestResult.java:106)

      at junit.framework.TestResult.runProtected(TestResult.java:124)

      at junit.framework.TestResult.run(TestResult.java:109)

      at junit.framework.TestCase.run(TestCase.java:120)

      at junit.framework.TestSuite.runTest(TestSuite.java:230)

      at junit.framework.TestSuite.run(TestSuite.java:225)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)

 

"Employees of Lonmin Platinum ("Lonplats") are not authorised to conclude
electronic transactions or to enter into electronic agreements on behalf
of Lonplats. Any electronic signature (other than an advanced electronic
signature as defined in the Electronic Communications and Transactions
Act of 2003) added to a data message (such as an email or an attachment
to an (email) ostensibly on behalf of Lonplats by a Lonplats employee shall
not be legally binding on Lonplats and Lonplats shall incur no liability of
any nature whatsoever, directly or indirectly, arising from such act on the
part of it's employee. It is further recorded that nothing (other than an
advanced electronic signature) inserted into any data message
emanating from Lonplats shall be construed as constituting an electronic
signature"

_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users