A rule engine for Java.

  1. Minimum runtime requirements for Drools
  2. Adding the source rule to elements inserted by Drools
  3. Tips and Techniques for Improving Drools Performance
  4. Improving Drools Memory Performance
  5. Drools Pygments Lexer

Important Hints

If you use the following in a Drools rule:

x : ObjectType( ) from other.property

It is important to realise that other.property will not be type checked; that is, **other.property may be a type other than ObjectType**.

You should instead use this:

x : ObjectType( object.property == this )

ClassNotFoundException with a ReturnValue Invoker

I was getting this exception for a fairly normal rule:

org.drools.RuntimeDroolsException: java.lang.ClassNotFoundException: org.openiaml.model.drools.Rule_Create_Select_Wire_between_Domain_Object_types_0ReturnValue0Invoker
  at org.drools.rule.PackageCompilationData.reload(PackageCompilationData.java:224)
  at org.drools.common.AbstractRuleBase$ReloadPackageCompilationData.execute(AbstractRuleBase.java:830)
  at org.drools.common.AbstractRuleBase.executeQueuedActions(AbstractRuleBase.java:792)
...
Caused by: java.lang.ClassNotFoundException: org.openiaml.model.drools.Rule_Create_Select_Wire_between_Domain_Object_types_0ReturnValue0Invoker
  at org.drools.rule.PackageCompilationData$PackageClassLoader.findClass(PackageCompilationData.java:374)
  at org.drools.rule.PackageCompilationData.wire(PackageCompilationData.java:255)
  at org.drools.rule.PackageCompilationData.reload(PackageCompilationData.java:220)
  ... 55 more

My rule was quite innocent:

rule "Create Select Wire between Domain Object types"
  when
    scope : Session ( )
    object: DomainObject ( eval(hasDomainAttribute(object)) )
    ...
  
  then
    ...

end

The problem is that you cannot have a variable named “object” passed to a function using eval. Not sure why, but this is the case in JBoss Drools 4.0.7.