DMN Table and Rest API


#1

I am testing DMN table using rest API in postman. When request the post service the postman is showing me “Exception while evaluating decision with key ‘null’” error.
I am not sure the error is from DMN engine side or from the postman side.

{

“variables”: {
“Vehicle_A”: {“value”: “A1”, “type”: “string”},
“Vehicle_B”: {“value”: “B2”, “type”: “string”}
}

}

P.S. - When i try to run the table using online simulator it works perfectly fine.

Can any one help me to understand what is the error ?

Regards,
Rohan


#2

This is the error from the server logs

23-Jul-2019 16:05:30.006 WARNUNG [http-nio-8080-exec-1] org.camunda.bpm.engine.rest.exception.RestExceptionHandler.toResponse org.camunda.bpm.engine.rest.exception.RestException: Cannot evaluate decision germany:1:4cf6625f-ad38-11e9-b8fe-9cb654a1c9d7: Exception while evaluating decision with key ‘null’
at org.camunda.bpm.engine.rest.sub.repository.impl.DecisionDefinitionResourceImpl.evaluateDecision(DecisionDefinitionResourceImpl.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:107)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:406)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:213)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:228)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.EmptyBodyFilter.doFilter(EmptyBodyFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.camunda.bpm.engine.ProcessEngineException: Exception while evaluating decision with key ‘null’
at org.camunda.bpm.engine.impl.dmn.cmd.EvaluateDecisionCmd.doEvaluateDecision(EvaluateDecisionCmd.java:90)
at org.camunda.bpm.engine.impl.dmn.cmd.EvaluateDecisionCmd.execute(EvaluateDecisionCmd.java:74)
at org.camunda.bpm.engine.impl.dmn.cmd.EvaluateDecisionCmd.execute(EvaluateDecisionCmd.java:44)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:107)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.dmn.DecisionEvaluationBuilderImpl.evaluate(DecisionEvaluationBuilderImpl.java:83)
at org.camunda.bpm.engine.rest.sub.repository.impl.DecisionDefinitionResourceImpl.evaluateDecision(DecisionDefinitionResourceImpl.java:141)
… 45 more
Caused by: org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${A}’
at org.camunda.bpm.dmn.engine.impl.DmnEngineLogger.unableToEvaluateExpression(DmnEngineLogger.java:38)
at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateElExpression(ExpressionEvaluationHandler.java:125)
at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateExpression(ExpressionEvaluationHandler.java:62)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateInputExpression(DecisionTableEvaluationHandler.java:193)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateInput(DecisionTableEvaluationHandler.java:122)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluateDecisionTable(DecisionTableEvaluationHandler.java:104)
at org.camunda.bpm.dmn.engine.impl.evaluation.DecisionTableEvaluationHandler.evaluate(DecisionTableEvaluationHandler.java:81)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateDecision(DefaultDmnDecisionContext.java:85)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecision(DefaultDmnEngine.java:167)
at org.camunda.bpm.engine.impl.dmn.invocation.DecisionInvocation.invoke(DecisionInvocation.java:57)
at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:58)
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:92)
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:63)
at org.camunda.bpm.engine.impl.util.DecisionEvaluationUtil.invoke(DecisionEvaluationUtil.java:100)
at org.camunda.bpm.engine.impl.util.DecisionEvaluationUtil.evaluateDecision(DecisionEvaluationUtil.java:87)
at org.camunda.bpm.engine.impl.dmn.cmd.EvaluateDecisionCmd.doEvaluateDecision(EvaluateDecisionCmd.java:87)
… 53 more
Caused by: org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘A’
at org.camunda.bpm.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
at org.camunda.bpm.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.camunda.bpm.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.camunda.bpm.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.camunda.bpm.engine.impl.dmn.el.ProcessEngineElExpression.getValue(ProcessEngineElExpression.java:47)
at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateElExpression(ExpressionEvaluationHandler.java:121)


#3

Hi @rohan.khanvilkar,

it seems that an expression try to access a variable A which is not defined.

The variable of your request contains no variable A.


#4

Hi Philipp,

I dont think i have specifically variable A in my table. I have Vehicle_A and A1 as the input for Vehicle_A. For more info please refer attached dmn table.

Thanks in advance for help.Liability_Germany.dmn (158.3 KB)


#5

Actually, the input expression of the input “Vehicle_A” is A. In order to read the variable Vehicle_A, you need to set the input expression to Vehicle_A. The label is just the name of the column.


#6

Ok now i am confused. Could you please explain a little more.

Regards,
Rohan


#7

Please have a look at the docs: https://docs.camunda.org/manual/7.11/reference/dmn11/decision-table/input/#input-expression

An input has a label and an input expression. The input expression is used to get the input value (i.e. the input of the input entry/condition). The label is not evaluated.


#8

Hi,

Sorry to bother you again. So according to your suggestion i have changed the input expression but i am facing the same error again.
Any other suggestions.

Attached is the error file and the table with updated changes.
Thankserror.txt (8.1 KB)
Liability_Germany.dmn (158.4 KB)


#9

Hi @rohan.khanvilkar,

in your DMN-table you say, that the input for the columns are “vehiclea” and “vehicleb”. But in your REST-call you use different names. Your REST-call should have parameters like this:

{
“variables”: {
“vehiclea”: {“value”: “A1”, “type”: “string”},
“Vehicleb”: {“value”: “B2”, “type”: “string”}
}
}

“vehiclea” and “vehicleb” are the names of your variables. “Vehicle_A” and “Vehicle_B” are not variables, these are just names (a describing text) that are displayed at the top of the column.

Hope this helps

Regards
Michael


#10

Hi,

In my rest calls i tried using the names vehiclea and vehicle.I
It still shows me the same errors.

Here is my updated rest calls

{

“variables”: {
“vehiclea”: {“value”: “A1”, “type”: “string”},
“vehiclea”: {“value”: “B2”, “type”: “string”}
}

}


#11

@rohan.khanvilkar

Is this the correct call? You are setting vehiclea two times and vehicleb not at all.


#12

Finally worked.
Found the issue.
Thanks a everyone for the help.