Vincent,
It seems it is a merging problem on declarations, but unfortunately, the exceptions you are seeing are the symptoms, not the cause, so I can't infer much from them.
Some suggestions to try to isolate the problem: are the fact types (classes) in the same package or different packages? Are the declaration(s)/rules in the same file or different files? Are you using a single kbuilder to build the whole thing on your application or using different kbuilders? Is the order in which you are loading the files into the kbuilder and the order you add packages in your kbase the same on your application and your test?
These are some of the conditions that trigger declaration merges. I know it is not much, but try checking these things... maybe you get lucky and manage to reproduce the problem so that we can debug it and fix it.
Also, which version of Drools are you using? Did you tried with latest snapshot from the 5.3.x branch or with master branch (5.4.x)?
Any additional information you can give us might help us figure out the problem.
Thanks,
Edson
On Mon, Nov 28, 2011 at 11:01 AM, Vincent LEGENDRE
<vincent.legendre@eurodecision.com> wrote:
Well, after trying and trying to reproduce with a simpler case, @role is always correctly inherited.
But in my application, it seems not, or may be it is another problem.
I have 3 classes : ChantierEvent (the main mother class) and its 2 subClasses : InitEvent and DisposeEvent
When I declare @role(event) for all 3 classes, everything works wells
When I only declare for the motherclass, this exception is raised (at insertion of a InitEvent) :
java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to org.drools.common.EventFactHandle
at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:316)
at org.drools.rule.VariableRestriction.isAllowedCachedRight(VariableRestriction.java:122)
at org.drools.rule.VariableConstraint.isAllowedCachedRight(VariableConstraint.java:121)
at org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:208)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:158)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
--> call of insert(new InitEvent(...));
at com.sncf.morse.server.MVFusionThreadSession.addEvent(MVFusionThreadSession.java:158)
I first think about a problem on "after" operator, so I commented out the rule that uses it, and this error is raised then (I also use sliding windows) :
java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to org.drools.common.EventFactHandle
at org.drools.rule.SlidingTimeWindow.updateNextExpiration(SlidingTimeWindow.java:211)
at org.drools.rule.SlidingTimeWindow.assertRightTuple(SlidingTimeWindow.java:128)
at org.drools.rule.BehaviorManager.assertRightTuple(BehaviorManager.java:84)
at org.drools.reteoo.NotNode.assertObject(NotNode.java:114)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
--> call of insert(new InitEvent(...));
at com.sncf.morse.server.MVFusionThreadSession.addEvent(MVFusionThreadSession.java:158)
Do you have any ideas on why this could happend ?
In what case the role could not be inherited (I tried to make my minimal sample class look like the real one, but I can't reproduce ..).
thanks
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com