我在尝试访问 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>
有人解决这个问题吗?