You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
When using POJO rules, how can I add facts in one rule that can be used by a subsequent rule in the same ruleset?
I saw in the FAQ that "If a fact is changed or added in a Rule then that change or addition is present for other Rules down the rule chain." But if I specify a @given for something that is not yet defined, it throws an error*. And it's not clear how I could create a new NameValueReferable that is then picked up and stored in the fact map.
[main] ERROR com.deliveredtechnologies.rulebook.model.runner.RuleAdapter - Unable to access test.rules.myrules.CatRule when converting then to Consumer java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.deliveredtechnologies.rulebook.model.runner.RuleAdapter.lambda$getThenMethodAsConsumer$14(RuleAdapter.java:292) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.deliveredtechnologies.rulebook.model.GoldenRule.lambda$invoke$8(GoldenRule.java:174) at java.util.Optional.ifPresent(Optional.java:159) at com.deliveredtechnologies.rulebook.model.GoldenRule.invoke(GoldenRule.java:171) at com.deliveredtechnologies.rulebook.model.runner.RuleAdapter.invoke(RuleAdapter.java:180) at com.deliveredtechnologies.rulebook.model.AuditableRule.invoke(AuditableRule.java:94) at com.deliveredtechnologies.rulebook.model.rulechain.cor.RuleHandler.handleRequest(RuleHandler.java:30) at com.deliveredtechnologies.rulebook.model.rulechain.cor.CoRRuleBook.lambda$run$2(CoRRuleBook.java:46) at java.util.Optional.ifPresent(Optional.java:159) at com.deliveredtechnologies.rulebook.model.rulechain.cor.CoRRuleBook.run(CoRRuleBook.java:44) at com.deliveredtechnologies.rulebook.model.runner.AbstractRuleBookRunner.run(AbstractRuleBookRunner.java:69) at test.rules.Test.main(Test.java:19) Caused by: java.lang.NullPointerException at test.rules.myrules.CatRule.then(CatRule.java:22) ... 20 more
The text was updated successfully, but these errors were encountered:
Could this be a bug? I noticed that declaring a fact works but as soon as I try to get or set it, it fails. I'm attaching a very simple example that shows this behavior, and fails even though I think it should run. non-working-example.tar.gz
holken1
changed the title
Question: Adding facts from POJO rule
Can't add new facts from POJO rule
Sep 16, 2019
holken1
changed the title
Can't add new facts from POJO rule
Can't add new facts in POJO rule
Sep 16, 2019
Hi.
When using POJO rules, how can I add facts in one rule that can be used by a subsequent rule in the same ruleset?
I saw in the FAQ that "If a fact is changed or added in a Rule then that change or addition is present for other Rules down the rule chain." But if I specify a @given for something that is not yet defined, it throws an error*. And it's not clear how I could create a new NameValueReferable that is then picked up and stored in the fact map.
*Error on undefined @given:
[main] ERROR com.deliveredtechnologies.rulebook.model.runner.RuleAdapter - Unable to access test.rules.myrules.CatRule when converting then to Consumer java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.deliveredtechnologies.rulebook.model.runner.RuleAdapter.lambda$getThenMethodAsConsumer$14(RuleAdapter.java:292) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.deliveredtechnologies.rulebook.model.GoldenRule.lambda$invoke$8(GoldenRule.java:174) at java.util.Optional.ifPresent(Optional.java:159) at com.deliveredtechnologies.rulebook.model.GoldenRule.invoke(GoldenRule.java:171) at com.deliveredtechnologies.rulebook.model.runner.RuleAdapter.invoke(RuleAdapter.java:180) at com.deliveredtechnologies.rulebook.model.AuditableRule.invoke(AuditableRule.java:94) at com.deliveredtechnologies.rulebook.model.rulechain.cor.RuleHandler.handleRequest(RuleHandler.java:30) at com.deliveredtechnologies.rulebook.model.rulechain.cor.CoRRuleBook.lambda$run$2(CoRRuleBook.java:46) at java.util.Optional.ifPresent(Optional.java:159) at com.deliveredtechnologies.rulebook.model.rulechain.cor.CoRRuleBook.run(CoRRuleBook.java:44) at com.deliveredtechnologies.rulebook.model.runner.AbstractRuleBookRunner.run(AbstractRuleBookRunner.java:69) at test.rules.Test.main(Test.java:19) Caused by: java.lang.NullPointerException at test.rules.myrules.CatRule.then(CatRule.java:22) ... 20 more
The text was updated successfully, but these errors were encountered: