Hi,
I have written a simple rule:
#list any import classes here.
import test.Person
rule "check pete"
when
fet : Person( name == "pete");
then
System.out.println("fet name " + fet.getName());
end
When I run this it passes;
But If I run the same rule but in the RHS I add the person to the list,
like so:
#list any import classes here.
import test.Person
#declare any global variables here
global java.util.List list
rule "check pete"
when
fet : Person( name == "pete");
then
list.add( fet );
end
I am getting the following error
org.drools.spi.ConsequenceException: java.lang.NullPointerException
at org.drools.common.Agenda.fireActivation(Agenda.java:316)
at org.drools.common.Agenda.fireNextItem(Agenda.java:290)
at
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:253)
at
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:266)
at client.test.RuleBootStrap.runRules(RuleBootStrap.java:51)
at client.test.RuleTest.testGetEmbo(RuleTest.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:481)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:347)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at
uk.ac.ebi.submission.rules.Rule_add_new_gene_symbol_0.consequence(Rule_add_new_gene_symbol_0.java:6)
at
uk.ac.ebi.submission.rules.Rule_add_new_gene_symbol_0ConsequenceInvoker.evaluate(Rule_add_new_gene_symbol_0ConsequenceInvoker.java:21)
at org.drools.common.Agenda.fireActivation(Agenda.java:313)
... 20 more
Any ideas?
Thanks in advance
--
Charlie