Drools-使用50多个规则以编程方式错误构建KIE模块

时间:2019-05-09 13:36:11

标签: drools

当我使用drool 7.20.Final编程编程时,我遇到一个奇怪的错误。

无法构建KieBaseModel:defaultKieBase [DialectError message ='无法连接已编译的类,可能与编译失败有关:无法连接JavaDialect']

代码正在从数据库获取规则集。奇怪的是,如果规则集包含49条规则,则构建成功。仅当我添加其他规则时,才会引发此错误!?

我使用的规则集有50条相同的规则:

package net.factuurcontrole.validate.invoice

import net.factuurcontrole.model.Invoice;

rule "Test - Rule 1"

    when
        Invoice()
    then
        // Something

end

rule "Test - Rule 2"

    when
        Invoice()
    then
        // Something

end

etc....

要构建的代码

KieServices kieServices = KieServices.Factory.get();
ReleaseId testReleaseId = kieServices.newReleaseId(KIE_GROUP_ID, KIE_CUSTOMER_VALIDATION_ID, String.valueOf(customerValidationSet.getVersion()));

KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.generateAndWritePomXML(testReleaseId);

String resourcePath = "src/main/resources/net/factuurcontrole/validate/invoice/";

for (ValidationRule validationRule : ValidationRuleLocalServiceUtil.getByValidationSet(validationSet.getValidationSetId())) {
    kieFileSystem.write(resourcePath + validationRule.getName() + ".drl", validationRule.getBody());
}

KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();

关于如何解决此问题的任何建议?

0 个答案:

没有答案