Hi,
I am getting the following error when I try to do complex object referencing in drools:
My class:
A{
String Type;
B objectb;
//getters and setters for above
}
My rules:
rule "prod"
when
$a :A(Type == "Prod" , objectB != "")
then
B bobject = new B();
bobject.setType( "Prod" );
bobject.setId($a.getNumber().getId());
update(bobject);
end
I want to basically output a file which has updated values of B (type, Id)
Error:
org.drools.spi.ConsequenceException: org.drools.FactException: Update error: handle not
found for object: com.org.Ip@f42ad0. Is it in the working memory?
at
org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439)
at com.org.DroolsTest.main(DroolsTest.java:30)
Caused by: org.drools.FactException: Update error: handle not found for object:
com.org.Ip@f42ad0. Is it in the working memory?
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:100)
at com.org.Rule_Prod_Ip_0.consequence(Rule_Prod_Ip_0.java:10)
at
com.org.Rule_Prod_Ip_0ConsequenceInvoker.evaluate(Rule_Prod_Ip_0ConsequenceInvoker.java:22)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554)
... 4 more
Please help! I am very new to drools! Not able to figure out why this error:
I am using eclipse and working on Windows machine. Error above was generated on eclipse
console.
Thank you.
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before
printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a
href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged,
confidential and protected from disclosure. If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have received this
communication in error, please notify the sender immediately by replying to the message,
and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>