简体   繁体   English

如何从 DMN model(Drools Business Central)调用 static Java 方法

[英]How do I call static Java method from DMN model (Drools Business Central)

I am using Business Central version 7.40.0.我正在使用 Business Central 版本 7.40.0。 When calling static Java method std from Drools Business Central DMN project/model, I'm getting following error:从 Drools Business Central DMN 项目/模型调用 static Java 方法std时,我收到以下错误:

DMN: Error compiling Java function 'stdev' on node 'stdev': Error resolving external function as defined by: function(val) external { java: { class: ""com.sample.StandardDeviation"", method signature: ""std(java.lang.Number)"" }}...
Error compiling the referenced FEEL expression

I have:我有:

  1. Created Maven jar with static Java method使用 static 方法 ZD52387880E1EA22817172D375921
package com.sample;

import java.math.BigDecimal;
    
public class StandardDeviation {
    
    public static BigDecimal std(Number val) {  
        return new BigDecimal(val.doubleValue() * 2);
    }
}
  1. Imported Jar as Artifacts to Drools Business Central ,将 Jar 作为工件导入 Drools Business Central

  2. Added Dependency to DMN project增加了对 DMN 项目的依赖

  3. In my DMN model, I am calling static Java method inside 'stdev' BKM (business knowledge model) element.在我的 DMN model 中,我在“stdev”BKM(业务知识模型)元素中调用 static Java 方法。 BKM with class and method signature带有 class 和方法签名的 BKM

    • class: "com.sample.StandardDeviation" class: "com.sample.StandardDeviation"
    • method signature: "std(java.lang.Number)"方法签名: "std(java.lang.Number)"
  4. Saving BKM/DMN or building the model gives above error保存 BKM/DMN 或构建 model 会出现上述错误

What could be the issue?可能是什么问题? Am I doing anything incorrectly?我做错了什么吗? How to check the logs in Drools Business Central?如何查看 Drools Business Central 中的日志?

We are aware of this issue as it was reported at DROOLS-5577我们知道这个问题,因为它在DROOLS-5577中报告过

Workaround exists as discussed in separate forum and as detailed in the JIRA issue, which was later confirmed by OP as in:解决方法存在于单独的论坛中讨论并在 JIRA 问题中进行了详细说明,后来由 OP 确认如下:

  1. Ignore this validation error (red popup) while Saving the DMN Model with the editor使用编辑器保存 DMN Model 时忽略此验证错误(红色弹出窗口)
  2. Proceed to Deploy the KJAR BC Project as usual像往常一样继续部署 KJAR BC 项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM