[rules-users] Drools crash on simple drl
Mark Proctor
mproctor at codehaus.org
Tue Apr 17 12:12:25 EDT 2012
If you think it's a bug, follow the instructions here on how to submit a
unit test demonstrating your bug:
https://hudson.jboss.org/hudson/job/droolsjbpm-knowledge/lastSuccessfulBuild/artifact/droolsjbpm-introduction-docs/target/docbook/publish/en-US/html_single/index.html#gettingstarted
Mark
On 17/04/2012 16:42, Shur, Bob wrote:
> I'm repeating this post because I didn't get an answer last time. Is this the wrong place to report a bug? If so, where is the right place? I'm trying to understand whether this is really a bug or whether I'm doing something wrong.
>
> 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
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list