Hi,
I’ve been experimenting with the Guided Rule Editor plug-in in Eclipse. I’ve built a Drools Project using the default Hello World sample application. I’ve created a new “Guided Rule” in my project called “GuidedRule.brl” and get the associated “drools.package” with it. The rule is simple:
WHEN
THEN
System.out.println(“Rule has fired”);
I build the knowledge base as follows:
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("SampleGuided.drl"), ResourceType.BRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
The only line changed is adding the resource of type BRL.
When I try to run, I get the following error:
java.lang.RuntimeException: org.drools.compiler.DroolsParserException: org.drools.CheckedDroolsException: Unable to find implementation for BusinessRuleProvider
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:544)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:41)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: org.drools.compiler.DroolsParserException: org.drools.CheckedDroolsException: Unable to find implementation for BusinessRuleProvider
at org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java:386)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:470)
... 3 more
Caused by: org.drools.CheckedDroolsException: Unable to find implementation for BusinessRuleProvider
at org.drools.compiler.BusinessRuleProviderFactory.throwNoImplementationFound(BusinessRuleProviderFactory.java:66)
at org.drools.compiler.BusinessRuleProviderFactory.loadProvider(BusinessRuleProviderFactory.java:42)
at org.drools.compiler.BusinessRuleProviderFactory.getProvider(BusinessRuleProviderFactory.java:25)
at org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java:366)
... 4 more
I’ve tried variations to add the drools.package as a PKG type, I’ve had the rules (and package) in both “com.sample” and /src/main/rules, but I can’t seem to resolve the problem. “drools.package” has been updated to include the package name (package com.sample;) and I import the message class as well (even though it isn’t being used currently).
I suspect the issue is simple, but I haven’t been able to figure it out. Any help would be appreciated.