首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在java委托中使用决策

在java委托中使用决策
EN

Stack Overflow用户
提问于 2017-03-21 20:51:01
回答 2查看 1.2K关注 0票数 1

我试图在我创建的camunda委托中评估一个决策。下面是我正在使用的代码。在执行委托(在没有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代码:

代码语言:javascript
复制
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);
EN

回答 2

Stack Overflow用户

发布于 2017-03-23 06:15:07

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

您也可以尝试门斯基示例,但是将camunda dmn更改为7.6.0和

代码语言:javascript
复制
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable("decision", "Example.dmn", variables);

代码语言:javascript
复制
    InputStream fileAsStream = IoUtil.fileAsStream("Example.dmn");
    DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable("decision", fileAsStream, variables);
票数 2
EN

Stack Overflow用户

发布于 2022-04-08 10:31:25

您可以根据键或Id使用委托服务进行决策评估,

例:-

公共空执行(DelegateExecution delegateExecution)抛出异常{ DecisionService decisionService =delegateExecution变量().evaluate();}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42937898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档