Red Hat Bugzilla – Bug 1294832
Unable to create knowledge base with Rule Templates
Last modified: 2016-01-18 04:54:59 EST
Description of problem: i'm trying to create a kmodule.xml file to load a decision table with rule template. I'm using the Drools example of rule templates loaded in a knowledgebase named DTableWithTemplateKB with kmodule.xml taken from the example.
In this example, the ExamplePolicyPricing.xls contains both data and RuleTable. The main purpose of Rule Templates is to provide a clean separation of data from the rule. Hence I've removed all content from the xls file except the data. When I do that, I'm getting an error that my xls file doesn't contain the RuleTable. Because I'm using rule template, drools should not expect the RuleTable in xls file.
Version-Release number of selected component (if applicable):
How reproducible: Consistently with Drools 6.3
Steps to Reproduce:
1. Change the decision table excel to contain only data (Cell B9:H21)
2. Modify DTableWithTemplateKB entry in kmodule.xml file in drools-examples/src/main/resources/META-INF/kmodule.xml with row="2" col="1"
3.Run the PricingRuleTemplateExample
Exception in thread "main" org.drools.template.parser.DecisionTableParseException: No RuleTable cells in spreadsheet.
Expected results: Rule should be loaded properly
There is a "Template" example under: https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/java/org/drools/examples/templates/SimpleRuleTemplateExample.java
That said, I also tried modifying the "DTableWithTemplateKS" example (https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/java/org/drools/examples/decisiontable/PricingRuleTemplateExample.java) as follows:-
<kbase name="DTableWithTemplateKB" packages="org.drools.examples.decisiontable">
Modified XLS file is also attached.
This also worked fine.
Created attachment 1113610 [details]
Modified XLS file
re: comment#2, can you provide a failing unit test demonstrating the issue as I am unable to reproduce. Thanks.
Can you please check what reported by Michael and eventually send a reproducer of the problem if it still doesn't work for you?
(In reply to Mario Fusco from comment #5)
> Can you please check what reported by Michael and eventually send a
> reproducer of the problem if it still doesn't work for you?
I tried it with the spreadsheet and kmodule xml from your message and I'm getting the same error. Can you please confirm if your test was done with Drools 6.3?
I just merged on master the pull request sent by Michael ( https://github.com/droolsjbpm/drools/pull/597/files ) that updates the example as you described. Please let me know if this is what you meant and if it works for you.
(In reply to Mario Fusco from comment #8)
> I just merged on master the pull request sent by Michael (
> https://github.com/droolsjbpm/drools/pull/597/files ) that updates the
> example as you described. Please let me know if this is what you meant and
> if it works for you.
I'm able to get it working. The problem was in dev environment with another rule excel in the class path. Sorry for false alarm. please close.