在java委托中使用决策

时间:2017-03-21 20:51:02

标签: camunda

我正在尝试评估我创建的camunda java委托中的决策。以下是我正在使用的代码。在执行委托(在没有DMN部分的情况下运行正常)时,我收到错误声明:

java.lang.NoClassDefFoundError: de/odysseus/el/util/SimpleContext"

我正在使用gradle并将以下内容添加到我的.build中:        compile 'org.camunda.bpm.dmn:camunda-engine-dmn' , 'org.camunda.bpm.dmn:camunda-engine-feel-juel:7.5.0-alpha2' , 'de.odysseus.juel:juel-spi:2.2.7', 'de.odysseus.juel:juel-api:2.2.7' , 'de.odysseus.juel:juel-impl:2.2.7'

有任何建议如何解决此错误?感谢。

DMN代码:

DmnEngine dmnEngine = DmnEngineConfiguration.createDefaultDmnEngineConfiguration().buildEngine();

// read the DMN XML file as input stream
InputStream inputStream = CheckDatafileExistsExecutor.class.getResourceAsStream("decision1.xml");

// parse the DMN decision from the input stream
DmnDecision decision = dmnEngine.parseDecision("Decision_13nychf", inputStream);

//accessing the input variables
VariableMap variables = Variables.fromMap((Map<String, Object>) decision);

// evaluate the decision table with the input variables
DmnDecisionTableResult result = dmnEngine.evaluateDecisionTable(decision, variables);

int size = result.size();
DmnDecisionRuleResult ruleResult = result.get(0);

1 个答案:

答案 0 :(得分:1)

删除所有依赖项,仅添加compile group: 'org.camunda.bpm.dmn', name: 'camunda-engine-dmn', version: '7.6.0'

您也可以尝试menskis示例,但将camunda-engine-dmn更改为7.6.0 和

DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable("decision", "Example.dmn", variables);

    InputStream fileAsStream = IoUtil.fileAsStream("Example.dmn");
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable("decision", fileAsStream, variables);