AnsweredAssumed Answered

context.getprocessengineconfiguration() is null in evaluating expression

Question asked by mf on Jun 13, 2015
Latest reply on Jun 17, 2015 by trademak
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(

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);
      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.