PLEASE READ CAREFULLY, AND UNTIL THE END. These two files (foo/Foo.java, foo/foo.drl) are sufficient to reproduce the bug, i.e., a diagnostic Exception in thread "main" [Error: could not access field: named.NamedEntity.x] [Near : {... x == 1 ....}] ^ followed by a hefty stack dump due to an insert of a Foo.
package foo; /*** not public ***/ class Foo { private int x = 1; public int getX(){ return x; } } package foo; rule "foo getX" when Foo( x == 1 ) then System.out.println( "some Foo.x == 1" ); end But note that the problem goes a little deeper. Remove the constraint, and the rule fires: rule "some Foo" when $foo: Foo() then System.out.println( "some Foo..." ); // works perfectly end But now try to print the matched Foo: rule "show all Foo factss" when $foo: Foo() then System.out.println( "Foo: " + $foo ); end Another dump: Exception in thread "main" java.lang.IllegalAccessError: tried to access class named.NamedEntity from class named.Rule_xxx_fd3f0f5f764b415691fbf49ce4def6d7DefaultConsequenceInvokerGenerated at named.Rule_xxx_fd3f0f5f764b415691fbf49ce4def6d7DefaultConsequenceInvokerGenerated.evaluate(Unknown Source) at named.Rule_xxx_fd3f0f5f764b415691fbf49ce4def6d7DefaultConsequenceInvoker.evaluate(Unknown Source) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230) at named.Main.execute(Main.java:83) I DO understand why this happens (so please DON'T explain it to me). HOWEVER, IF PACKAGE VISIBILITY CANNOT BE HANDLED (and I don't think it can), IT SHOULD BE REFUTED WITH A PROPER DIAGNOSTIC. -W _______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev