有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何从DMN模型调用静态Java方法(Drools Business Central)

我正在使用Business Central 7.40.0版。从Drools Business Central DMN项目/模型调用静态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

我有:

  1. 使用静态Java方法创建Maven jar
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

  2. Added Dependency to DMN project

  3. 在我的DMN模型中,我在'stdev'BKM(业务知识模型)元素中调用静态Java方法BKM with class and method signature

    • 类:"com.sample.StandardDeviation"
    • 方法签名:"std(java.lang.Number)"
  4. 保存BKM/DMN或建立模型会产生上述错误

可能是什么问题? 我做错什么了吗? 如何检查Drools Business Central中的日志


共 (1) 个答案

  1. # 1 楼答案

    正如在DROOLS-5577上报告的那样,我们知道这一问题

    正如在单独的论坛中所讨论的和JIRA问题中所详述的那样,存在着变通办法,该问题稍后由OP在以下内容中介绍:

    1. Ignore this validation error (red popup) while Saving the DMN Model with the editor
    2. Proceed to Deploy the KJAR BC Project as usual