[rules-users] ClassCastException caused by generated java code?!

Krister Saleck krister.saleck at mytoys.de
Thu Jun 28 13:33:06 EDT 2007


Hi,

thanks for the new features in 4.0MR3 - now i may get rid
of some of my workarounds :-)

Unfortunately one problem still pops up in MR3:

Some generated code causes a ClassCastException while casting to
a implementation class. Because JBossRules wraps Facts by a generated
class implementing the facts interface, there should only be some
casting to the interface class?!

---
caused by: java.lang.ClassCastException: de.myToys.CallContextImpl
	at
de.myToys.konsum.core.account.rules.Rule_Buyer_neutral_0Eval0Invoker.eva
luate(
		Rule_Buyer_neutral_0Eval0Invoker.java:12)
	at
org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:71)
---
rule "Buyer neutral"
	when
		$c : CallContext(cause == "checkout", state == "new")
		$order : Order()
		(Quality(value == 1) or Quality(value == 2))
		eval($order.getBuyer().isProspect())
	then
		$c.setState("neutral");
end
---

If I execute the rule without the "or" term i do not run into
that problem.... bad rule style?

Did anyone have a hint? 

Thanks in advance,
Krister




More information about the rules-users mailing list