“在输入n处没有可行的替代方案”和“输入不匹配”

时间:2014-09-22 20:54:59

标签: java drools business-rules drools-fusion

我有以下课程

public class DroolsObjectRule {

    private String backend;
    private Long time;
    private Long avgTime;
    private boolean allow=true;
    private String message;

    //Set

    //Get
}

我的规则

rule "rule_3_increment_more"
  salience 3
  when
    $drol: DroolsObjectRule(backend == "AD1" &&  (2 * $drol.avgTime) > $drol.time) [this is line 33]
  then
    $drol.setMessage("RULE 3");
end

当我运行代码时,我收到以下错误

Caused by: java.lang.IllegalArgumentException: 
 [33,48]: [ERR 101] Line 33:48 no viable alternative at input '2'
          in rule "rule_3_increment_more" in pattern DroolsObjectRule
 [33,79]: [ERR 102] Line 33:79 mismatched input ')' expecting '('
          in rule "rule_3_increment_more" in pattern DroolsObjectRule in pattern $drol.time

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

规则在5.3.0,5.6.0,5.5.0,6.0.0和6.1.0中正常工作。

如果您使用旧版本,请坚持使用旧版约束:

DroolsObjectRule( backend == "AD1", $avgTime: avgTime,
                  time < 2*$avgTime )