0

我在尝试访问 Guvnor 模型时遇到了这个问题。这里的代码:

RuleAgent ruleAgent = RuleAgent.newRuleAgent("/guvnor.properties");
RuleBase ruleBase = ruleAgent.getRuleBase();
FactType factype = ruleBase.getFactType("sample.Number");
Object obj = factype.newInstance();
factype.set(obj, "numberOne", 1);
factype.set(obj, "numberTwo", 1);
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(obj);
workingMemory.fireAllRules();
System.out.println(factype.get(obj, "message"));

执行此行时出现问题: RuleBase ruleBase = ruleAgent.getRuleBase(); 并返回我这个例外:

java.lang.ClassCastException:[Lorg.drools.rule.Package;不能转换为 org.drools.rule.Package

这是我的配置:

jboss-eap-6.1

guvnor-5.5.0.Final-jboss-as-7.0.war

我的 pom.xml:

<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.5.0.Final</version>
</dependency>

<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.5.0.Final</version>

有人解决这个问题吗?

4

1 回答 1

0

我正在使用 drools 5.4 版,这是 guvnor 5.4 中的常见错误。我想这个问题在 drools 5.5.0.Beta1 版中已修复,

请查看 https://issues.jboss.org/browse/JBRULES-3590

问候 Ganesh N ganeshneelekani@gmail.com

于 2013-10-08T10:46:09.043 回答