I have what looks to me like a Drools bug on a simple drl with declared classes. I'm
using version drools-distribution-5.3.0.Final.
I'm invoking it with this:
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
List<Object> facts = new ArrayList<Object>();
ksession.execute( facts );
=============================
I get this crash:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/sample/Cap
at ASMAccessorImpl_129541121334339192620.getValue(Unknown Source)
at
org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:73)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:103)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
at org.mvel2.MVEL.executeExpression(MVEL.java:952)
...
==========================
Here's the drl file:
package com.sample
import com.sample.*;
declare Item
id : int;
end
declare Priority
name : String;
priority : int;
end
declare Cap
item : Item;
name : String
end
rule "split cart into items"
when
then
insert(new Item(1));
insert(new Item(2));
insert(new Item(3));
end
rule "Priorities"
when
then
insert(new Priority("A", 3));
insert(new Priority("B", 2));
insert(new Priority("C", 5));
end
rule "Caps"
when
$i : Item()
$p : Priority($name : name)
then
insert(new Cap($i, $name));
end
rule "test"
when
$i : Item()
Cap(item.id == $i.id)
then
System.out.println("Cap");
end
====================
Some observations:
- If I comment out any of the insert lines, the crash goes away
- If I change the first field of class Cap to be id:int instead of item:Item and make the
corresponding changes, the crash goes away
Show replies by date