All my rules worked fine with Drools 3. NowI am trying to upgrade to
Drools 5.
I am using the following jar files to create binary (jar) files for my
rules from command line:
antlr-runtime.jar, drools-api.jar, drools-compiler.jar, drools-core.jar,
drools-decisiontables.jar, drools-jsr94.jar, drools-templates.jar,
janino-2.5.15.jar, joda-time.jar, jsr94.jar, jxl.jar, mvel2.jar,
xpp3.jar, xpp3_min.jar, xstream.jar,
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar
This is my DSLR:
package cit.coverage;
expander Coverage.dsl
rule "rrr"
auto-focus true
when
He is nice
then
He is happy
end
This is my DSL Coverage.dsl:
[condition][]He is nice=eval(true)
[consequence][]He is happy=eval(System.out.println("HA HA"))
I am trying to create binary(jars) using the following code:
KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbc.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilder builder = null;
builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
Reader drlSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDrlSourc
e()));
//ruleset.getDrlSource() = com/cit/myDrl.dslr
Reader dslSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDslSourc
e()));
builder.add(ResourceFactory.newReaderResource(dslSource),
ResourceType.DSL);
builder.add(ResourceFactory.newReaderResource(drlSource),
ResourceType.DSLR); <-- problem
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(builder.getKnowledgePackages());
no matter what I type in my dslr (drl) file I get the following
exception on the highlighted line;
I have 1 rule or 0 rule it still throws the same exception. Does it have
to do with any jar files?
Caused by: java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:830)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:555)
at
org.drools.compiler.PackageBuilder.addPackageFromDslr(PackageBuilder.jav
a:355)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:461)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
saleem
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Friday, March 04, 2011 2:14 AM
To: Rules Users List
Subject: Re: [rules-users] Problem creating package
-validateUniqueRuleNames(PackageBuilder.java:830)
It could be an error in the DSL file. Check for errors after *each*
builder.add(...).
-W
2011/3/4 Saleem Lakhani <Saleem.Lakhani(a)citizensfla.com>:
Following is my code:
KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbc.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilder builder = null;
builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
Reader drlSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDrlSourc
e()));
//ruleset.getDrlSource() = com/cit/myDrl.dslr
Reader dslSource = new
InputStreamReader(RVEngine.class.getResourceAsStream(ruleset.getDslSourc
e()));
builder.add(ResourceFactory.newReaderResource(dslSource),
ResourceType.DSL);
builder.add(ResourceFactory.newReaderResource(drlSource),
ResourceType.DSLR);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(builder.getKnowledgePackages());
no matter what I type in my dslr (drl) file I get the following
exception on
the highlighted line; ANY IDEA????
I have 1 rule or No rule it still throws the same exception. Does it
have to
do with any jar files?
Caused by: java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:830)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:555)
at
org.drools.compiler.PackageBuilder.addPackageFromDslr(PackageBuilder.jav
a:355)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:461)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
saleem
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users