Hi,
I am using the following code for adding DSLs to my
knowledge base and I keep getting following error
My code :
private KnowledgeBase loadRules(String[] rules) throws Exception{
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add(ResourceFactory.newClassPathResource("/sample-dsl.dsl"),ResourceType.DSL);
builder.add(ResourceFactory.newClassPathResource("/Rule1.dslr"), ResourceType.DSLR);
if (builder.hasErrors()) {
throw new RuntimeException(builder.getErrors().toString());
}
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());
return knowledgeBase;
}
Error Stack:
Exception in thread "main" java.lang.NoSuchMethodError:
org.drools.compiler.PackageBuilder.addKnowledgeResource(Lorg/drools/io/Resource;Lorg/drools/builder/ResourceType;Lorg/drools/builder/ResourceConfiguration;)V
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:30)
at com.org.RuleRunner.loadRules(RuleRunner.java:51)
at
com.org.RuleRunner.runStatelessRules(RuleRunner.java:127)
at com.org.RulesTest.main(RulesTest.java:41)
I have added all the required .jars for processing knowledge
builder.
I have the drools-compiler.jar5.0.1 added to my classpath ( I
downloaded it online)
Could you point me towards where I could download the
correct drools-compiler and drools-core.jar files from?? Seems like the ones I
have added to my classpath are not in harmony with each other.
Thank you. Please help.
M
Please consider the environment before printing this email.
Visit our website at http://www.nyse.com
*****************************************************************************
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.