KieContainer kieContainer = KieServices.Factory.get().getKieClasspathContainer();
The method in the previous line returns a container, but the object "kieContainer" has null values. It does not have a "containerId" and the fields in kProject (which is a field in kieContainer) have 0 as values. There is a META-INF directory in resources, which contains a kmodule.xml. The contents of kmodule.xml are:
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase packages="com.ruleEngine.drools.section03.step1">
<ksession name="StatelessPassportValidationStep1" type="stateless"/>
</kbase>
</kmodule>
What is the correct way to call the getClasspathContainer()
method?
So here is the solution. If you try to generate a project in IDEA with addition of JBoss Drools library, it downloads Drools_6_2_0.xml into .idea/libraries (it's not maven repo source). And again if you try to get classpath container in anywhere, the versions become mismatched (the version you declared in pom.xml and drools 6.2.0) and it brings null values in "kieContainer" object. Just remove the Drools_6_2_0.xml file and problem will be solved. Thanks to Roddy for ideas.