Bug 1257015 - NPE while using global object in a rule
NPE while using global object in a rule
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Edson Tirelli
Marek Winkler
Depends On:
  Show dependency treegraph
Reported: 2015-08-26 01:29 EDT by Abhijit humbe
Modified: 2015-09-02 12:13 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-09-02 12:13:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
reproducer (325.11 KB, application/zip)
2015-08-26 01:29 EDT, Abhijit humbe
no flags Details

  None (edit)
Description Abhijit humbe 2015-08-26 01:29:41 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/ Error calling container 'project1': Exception executing consequence for rule "TestRule" in defaultpkg: java.lang.NullPointerException
        at org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
. .
We can execute same rule without any issue through business rule task or through RemoteRestAPI. 

Version-Release number of selected component (if applicable):

How reproducible:

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.

Actual results:
Rule execution failed with NPE when we try to execute rule through /kie-server

Expected results:
Rule should executed successfully through /kie-server as well.

Additional info:
Comment 2 Edson Tirelli 2015-08-27 17:04:26 EDT
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:

POST .../services/rest/server/containers/project1
  <set-global identifier="obj">

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.
Comment 5 Abhijit humbe 2015-09-02 12:13:16 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.