我在尝试访问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
我的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>
有人解决了这个问题吗?
答案 0 :(得分:0)
我正在使用drools版本5.4,这是guvnor 5.4中的常见错误。我想这个问题已在drools版本5.5.0.Beta1中修复,
请检查 https://issues.jboss.org/browse/JBRULES-3590
此致 Ganesh N. ganeshneelekani@gmail.com