I have a helper method to evaluate expressions in an execution:
public Object evaluateExpression(DelegateExecution execution, String expr) {
Expression expression = expressionManager.createExpression(expr);
return expression.getValue(execution);
}
but in calling this method, the expression.getValue() method throws NullPointerException (only in evaluating expressions by this method):
java.lang.NullPointerException at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:45)
It shows that Context.getProcessEngineConfiguration() is null:
public Object getValue(VariableScope variableScope) {
ELContext elContext = Context.getProcessEngineConfiguration().getExpressionManager().getElContext(variableScope);
try {
ExpressionGetInvocation invocation = new ExpressionGetInvocation(valueExpression, elContext);
Context.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(invocation);
return invocation.getInvocationResult();
} catch (PropertyNotFoundException pnfe) {
throw new ActivitiException("Unknown property used in expression: " + expressionText, pnfe);
} catch (MethodNotFoundException mnfe) {
throw new ActivitiException("Unknown method used in expression: " + expressionText, mnfe);
} catch(ELException ele) {
throw new ActivitiException("Error while evaluating expression: " + expressionText, ele);
} catch (Exception e) {
throw new ActivitiException("Error while evaluating expression: " + expressionText, e);
}
}
I'm not sure what is wrong! I'm using version 5.17.0.Thanks in advance for any help you are able to provide.