Ramesh C
Ramesh C

Reputation: 83

java.lang.RuntimeException: Unexpected global [APPUSER]

We are using rule engine in our application using below the drools related dependencies

<properties>
<runtime.version>7.60.0.Final</runtime.version>
</properties>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-core</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-compiler</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-decisiontables</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.kie</groupId>
  <artifactId>kie-api</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.jbpm</groupId>
  <artifactId>jbpm-bpmn2</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.jbpm</groupId>
  <artifactId>jbpm-flow</artifactId>
  <version>${runtime.version}</version>
</dependency>
<dependency>
  <groupId>org.jbpm</groupId>
  <artifactId>jbpm-flow-builder</artifactId>
  <version>${runtime.version}</version>
</dependency>

Private void updateUserAccessFunction(User user) throws UserException {
 KieSession skieSession = RuleFactory.INSTANCE.CreateKieSession();
  skieSession.setGlobal("APPUSER",false);
  skieSession.insert(user);
  Map<String,Obejct> data = new HashMap<String,Object>();
   data.put("user",user);
   skieSession.startProcess("userenrichmentrules",user);
}

userFunctions.drl
global Boolean APPUSER;

Facing Vulnerabilities issues with 7.9.0.Final version so we are upgrading 7.60.0.Final version,while calling the rules part getting below error,

i can see the global variable AppUser in drl file.

global Boolean AppUser;

This error occurs when I try to set a global variable in KieSession Seeing the method StatefulKnowledgeSessionImpl#setGlobal(String, Object) seems that I should set the globals before create a newInstance

why it is not picking my global variable? or i need to set the global varibale is any other way?

ERROR: java.lang.RuntimeException: Unexpected global [AppUser]

Please help me to resolve it

TIA

Upvotes: 0

Views: 201

Answers (0)

Related Questions