Using DMN within a java delegate

Hi,
I am trying to evaluate a decision inside a java delegate that I created. Following is the code that I am using. Upon executing the delegate( which runs fine without the DMN part), I get an error stating:
java.lang.NoClassDefFoundError: de/odysseus/el/util/SimpleContext"

I am using gradle and have added the following to my .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’

Any suggestion how can I fix this error up? Thanks.

DMN Code:
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);

Hi @droy,

the easiest way to evaluate a decision inside a process is to use a business rule task. It invokes the DMN engine and handles all the variable and result stuff.

Does this help you?

Best regards,
Philipp

Hello @Philipp_Ossler,
Thanks a lot for replying.
I am evaluating the pros and cons of using a business rule task vs delegate for a decision for our project. I have few queries regarding that. Would you be so kind enough to answer them.

  1. Is there some place I can see what are the pros and cons of each approach
  2. Is there a “Getting Started” page for business rule task that I can use
  3. I get an “DMN-02003 Unable to transform decisions from input stream.” error when trying to deploy the decision before evaluating it. How can I get this resolved.
    Thanks.

Hi @droy,

regarding you questions,

  1. There are no cons for a business rule task. It’s just like a service task which invokes the DMN engine and maps the decision result.
  2. The user guide shows how to use a business rule task.
  3. It seems that there is something wrong with your decision table. You should find the reason as cause of the error.

Does this help you?

Best regards,
Philipp

@Philipp_Ossler:
Yes, it does help me.
I will check my model to see if there is any discrepancy, and update this message otherwise.
Some of the code snippets for using a decision doesnt show a deployment of the model. So, is a deployment necessary before evaluating the result.

thanks,

Hi @droy,

when you use a business rule task then you have to deploy the decision definition first. It’s similar to processes - you have to deploy a process definition before you can start a new instance of it.

Best regards,
Philipp