Hello,
I try to use several drl files declared with same package with a dsl, but
it doesn't work.
java.lang.RuntimeException: ExempleTest6.java *****************: Unable to
compile drl files.....
at com.pv.rules.test.Exemple6Test.readRule(Exemple6Test.java:85)
at com.pv.rules.test.Exemple6Test.test1(Exemple6Test.java:35)
at com.pv.rules.test.Exemple6Test.main(Exemple6Test.java:26)
I have an Unexpected token from a word that I've define on my dsl which
works if I use only one drl file.
I used that to check errors:
// Check the builder for errors
if ( builder.hasErrors() ) {
System.out.println( builder.getErrors().toString() );
throw new RuntimeException( "ExempleTest6.java
*****************:
Unable to compile drl files.....");
}
I use that in my java readRule method :
private static RuleBase readRule() throws Exception {
Reader source1 = new InputStreamReader(
Exemple6Test.class.getResourceAsStream( "/com/pv/rules/drl/Exemple61.drl"
) );
Reader source2 = new InputStreamReader(
Exemple6Test.class.getResourceAsStream(
"/com/pv/rules/drl/Exemple62.drl" ) );
Reader dsl = new InputStreamReader(
Exemple6Test.class.getResourceAsStream(
"/com/pv/rules/dsl/XPathLanguageExemple4.dsl" ) );
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( source1, dsl );
builder.addPackageFromDrl( source2, dsl );
builder.addPackageFromDrl( source3, dsl );
// Check the builder for errors
if ( builder.hasErrors() ) {
System.out.println( builder.getErrors().toString() );
throw new RuntimeException( "ExempleTest6.java *****************:
Unable to compile drl files.....");
}
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
Do you have an idea ?
Thanks :-)
PS: Sorry for the previous message, I sent it in error, I didn't finish to
type it.
Show replies by date