springspring-bootdroolsbusiness-ruleskie

Drools not able to load rules in Spring Boot Project


I am using the Drools 7.5.0-final in the spring Boot project.

I am working on a multi-module Gradle project. Rules and kmodule.xml is present in the sub-module project. This module is packaged as a Jar inside a fat spring boot Jar file.

  <?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://jboss.org/kie/6.0.0/kmodule">
<!-- <configuration>
  <property key="drools.propertySpecific" value="ALLOWED"/>
</configuration> -->

<kbase name="rules.employee.tax"   packages="uk.gov.hmrc.itmp.service.application.rules.employee.tax" > 
<ksession name="rules.employee.tax.session" type="stateful"  />
<ksession name="rules.employee.tax.statelesssession" type="stateless" />
</kbase>  
</kmodule>

I am building the container from the classpath.

KieContainer kContainer = kieService.newKieClasspathContainer();

on server start-up (java -jar) it loads the Kmodule.xml and prints all the kbase and sessionName.

But when I fire rules it returns zero rules fired.

It works fine when I run as spring boot app from Eclipse. Please help.


Solution

  • That was the bug in Drools and has been solved under this JIRA : https://issues.redhat.com/browse/DROOLS-2311?_sscc=t