每当我使用条件值时,Drools错误“java.lang.RuntimeException”

问题描述 投票:0回答:1

您好我的drools程序出现以下错误:

java.lang.RuntimeException:无法获取KieModule,存在错误

我的.drl文件如下:

package com.baeldung.drools.rules

import com.model.Variable;
import com.model.Recommendation;

global com.model.Recommendation recommendation;
dialect "mvel" 

rule "Rule 0"
when
variable1:Variable(Name=="Number of cigs per day", NumericValue>0)             
then
recommendation.setRecommendation("Encourage smoking cessation.");
end
rule "Rule 1"
when
variable1:Variable(Name=="Smoker", Value=="Yes")             
then
recommendation.setRecommendation("Encourage smoking cessation.");
end

在我的Variable对象中,我添加了一个Double NumericValue和一个String Value。如果我删除规则0,.drl编译器将工作并检测规则1,但是对于规则0,编译器始终生成KieModule编译器错误。我不知道我的代码有什么问题,以及为什么它不能使用条件比较的规则进行编译。

drools
1个回答
1
投票

我解决了我的问题。问题不在.drl文件中,而是在我的Variable类中没有公共getNumericValue()构造函数。

© www.soinside.com 2019 - 2024. All rights reserved.