Hi All,
I am using Drools 4.0.3
I have the following in drl file.
package com.framework.service.remote.rules;
import com.framework.service.EssRuleConditionService;
import com.framework.service.util.CurrentLeg;
import java.util.ArrayList;
import java.util.List;
import java.lang.Boolean;
function List depStationFun68307cu() {
EssRuleConditionService essRuleConditionService = new
EssRuleConditionService();
essRuleConditionService.setDepStation("21618");
return essRuleConditionService.getDepStation();
}
function List depStationFun68308cu() {
EssRuleConditionService essRuleConditionService = new
EssRuleConditionService();
essRuleConditionService.setDepStation("20932");
return essRuleConditionService.getDepStation();
}
function List depStationFun68309cu() {
EssRuleConditionService essRuleConditionService = new
EssRuleConditionService();
essRuleConditionService.setDepStation("21972");
return essRuleConditionService.getDepStation();
}
rule "68307"
dialect "java"
when
currentLeg : CurrentLeg()
eval(currentLeg.getORGSTN().size()!=0 &&
depStationFun68307cu().containsAll(currentLeg.getORGSTN()))
then
currentLeg.setDataProcessedByDrool(new Boolean(true));
currentLeg.setRuleSetId("9003");
currentLeg.setFssBoardDailyLegId("");
end
rule "68308"
dialect "java"
when
currentLeg : CurrentLeg()
eval(currentLeg.getORGSTN().size()!=0 &&
depStationFun68308cu().containsAll(currentLeg.getORGSTN()))
then
currentLeg.setDataProcessedByDrool(new Boolean(true));
currentLeg.setRuleSetId("9003");
currentLeg.setRuleSetCategoryId("15722");
currentLeg.setFssBoardDailyLegId("");
end
rule "68309"
dialect "java"
when
currentLeg : CurrentLeg()
eval(currentLeg.getORGSTN().size()!=0 &&
depStationFun68309cu().containsAll(currentLeg.getORGSTN()))
then
currentLeg.setDataProcessedByDrool(new Boolean(true));
currentLeg.setRuleSetId("9003");
currentLeg.setRuleSetCategoryId("15722");
currentLeg.setFssBoardDailyLegId("");
end
I have the following code to access drl file :
// get the .drl constructed as inputstream
// droolsInputString is drl file read into String.
// I dont have any issue reading the file but i get the null pointer exception
byte[] bytesOfDRL = droolsInputString.getBytes();
InputStream inputStream = new ByteArrayInputStream(bytesOfDRL);
Reader source = new InputStreamReader(inputStream);
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
PackageBuilder builder = new PackageBuilder(conf);
builder.addPackageFromDrl(source);
// when the last line is executed. builder.addPackageFromDrl(source);
Here i get the following exception
17:57:50,776 ERROR [STDERR] java.lang.NullPointerException
17:57:50,776 ERROR [STDERR] at
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(JavaConsequenceBuilder.java:54)
17:57:50,776 ERROR [STDERR] at
org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:67)
17:57:50,776 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
17:57:50,791 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
17:57:50,791 ERROR [STDERR] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
17:57:50,791 ERROR [STDERR] at
com.egatematrix.ess.framework.service.remote.rules.RulesEngineInvoker.readRule(RulesEngineInvoker.java:108)
17:57:50,791 ERROR [STDERR] at
com.egatematrix.ess.framework.service.RuleService.doProcess(RuleService.java:302)
17:57:50,791 ERROR [STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData.invokeRuleService(FetchFSSData.java:141)
17:57:50,791 ERROR [STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData.triggerData(FetchFSSData.java:69)
17:57:50,791 ERROR [STDERR] at
com.egatematrix.ess.framework.service.FetchFSSData$1.run(FetchFSSData.java:85)
17:57:50,791 ERROR [STDERR] at java.util.TimerThread.mainLoop(Timer.java:512)
17:57:50,791 ERROR [STDERR] at java.util.TimerThread.run(Timer.java:462)
I have tried compiling the drl file in drl editor. There is no error in drl file.
Can any one help me resolving the issue?
Regards,
Shiva
Tel: +91-40-27782000 Ext: 4259
Show replies by date