Red Hat Bugzilla – Bug 1257015
NPE while using global object in a rule
Last modified: 2015-09-02 12:13:16 EDT
Created attachment 1067141 [details]
Description of problem:
when we use global objects in rules and try to execute rules through /kie-server it fails with NullPointerException.
ERROR [org.kie.server.services.rest.KieServerRestImpl] (http-localhost.localdomain/127.0.0.1:8080-6) Error calling container 'project1': Exception executing consequence for rule "TestRule" in defaultpkg: java.lang.NullPointerException
We can execute same rule without any issue through business rule task or through RemoteRestAPI.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. place attached .niogit and repository directories under $JBOSS_HOME/bin directory.
2.Build project and configure kie-server to execute rules, it fails with NPE.
3. Now try to execute same rule through RemoteREST API's or through Business Rule Task, rule executed without any issue.
Rule execution failed with NPE when we try to execute rule through /kie-server
Rule should executed successfully through /kie-server as well.
Abhijit, I am trying to understand what the customer is doing here but I am confused. How is he executing the rules on the kie-server? More specifically, is he using the SetGlobalCommand to set the global before firing the rules?
While the business rules task and remote rest API run collocated with the workbench, the execution server (kie-server) is supposed to run "standalone". This way, it is necessary to set the global as part of the request.
For instance, the following is a valid REST POST body:
It returns the following result:
<response type="SUCCESS" msg="Container project1 successfully called.">
Of course, you can use the Java client API to do the same.
Please let me know if the customer has any other questions.
Edson, this issue is resolved after setting global as a part of request payload.
I am going ahead and closing this bugzilla. Thank you for help.