Bug 1257015 - NPE while using global object in a rule
Summary: NPE while using global object in a rule
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Edson Tirelli
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-26 05:29 UTC by Abhijit humbe
Modified: 2015-09-02 16:13 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-09-02 16:13:16 UTC
Type: Bug
Embargoed:


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

Description Abhijit humbe 2015-08-26 05:29:41 UTC
Created attachment 1067141 [details]
reproducer

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
        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 21:04:26 UTC
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
<batch-execution>
  <set-global identifier="obj">
    <com.redhat.sample.Test/>
  </set-global>
  <fire-all-rules/>
</batch-execution>

It returns the following result:

<response type="SUCCESS" msg="Container project1 successfully called.">
   <results><execution-results/></results>
</response>

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 16:13:16 UTC
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.