-
Bug
-
Resolution: Done
-
Major
-
5.1.1.FINAL
-
None
We have drl files where we declare events. we use declarative events (there is no java class AlertaPosManual)
(like this)
declare AlertaPosManual
@role (event)
@expires(10s)
idTerminal : java.lang.String
end
We use a StatefullSession for fusion cep and we need that changes in rules refresh the kBase in runtime. But when a rule condition changes this exception in throw
Exception in thread "Thread-2" java.lang.ClassCastException: com.sample.ConsumoPostManual cannot be cast to com.sample.ConsumoPostManual
at org.drools.base.com.sample.ConsumoPostManual17710704$getIdTerminal.getValue(Unknown Source)
at org.drools.base.extractors.BaseObjectClassFieldReader.getHashCode(BaseObjectClassFieldReader.java:192)
at org.drools.base.ClassFieldReader.getHashCode(ClassFieldReader.java:193)
at org.drools.core.util.AbstractHashTable$SingleIndex.hashCodeOf(AbstractHashTable.java:582)
at org.drools.core.util.RightTupleIndexHashTable.getOrCreate(RightTupleIndexHashTable.java:360)
at org.drools.core.util.RightTupleIndexHashTable.add(RightTupleIndexHashTable.java:243)
at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:246)
at org.drools.reteoo.ObjectTypeNode.updateSink(ObjectTypeNode.java:276)
at org.drools.reteoo.PropagationQueuingNode.updateSink(PropagationQueuingNode.java:111)
at org.drools.reteoo.BetaNode.attach(BetaNode.java:214)
at org.drools.reteoo.builder.BuildUtils.attachNode(BuildUtils.java:151)
at org.drools.reteoo.builder.CollectBuilder.build(CollectBuilder.java:114)
at org.drools.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:111)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java:72)
at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:132)
at org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:78)
at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:155)
at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:128)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:117)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:428)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:721)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:545)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:445)
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:452)
at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:937)
at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:821)
at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
at java.lang.Thread.run(Thread.java:619)
I think that's because the statefullSession has an instance of
com.sample.ConsumoPostManual (loaded with the classLoader
org.drools.rule.JavaDialectRuntimeData$PackageClassLoader@1218b25) But when
the kBase is regenerated and the class com.sample.ConsumoPostManual to, the
classLoader org.drools.rule.JavaDialectRuntimeData is recreated so there
are two versions of the class com.sample.ConsumoPostManual in differents
classLoader (one in the statefullSession and the other in the kBase)
- duplicates
-
JBRULES-2962 Knowledge Agent rebuilding KnowledgeBase with scanner/notifier does not work with declared facts
- Resolved