AnsweredAssumed Answered

Problems accessing the context variables - expression

Question asked by puel on May 25, 2012
Latest reply on May 25, 2012 by ronald.van.kuijk
Hi,

I adjusted slightly the sample code to use an expression:


    <serviceTask id="serviceTask" activiti:delegateExpression="${delegateExpressionBean}" />
    <sequenceFlow id="flow2" sourceRef="serviceTask" targetRef="userTask" />
   
    <serviceTask id="userTask" activiti:expression="${delegateExpressionBean.foo()}" activiti:resultVariableName="foo" />
    <sequenceFlow id="flow3" sourceRef="userTask" targetRef="end" />

I can access everything - as long I have not the "userTask". As soon this service task is eddit this code fails:


    System.out.println(((ExecutionEntity)procInst).getVariables());
    assertEquals("Activiti BPMN 2.0 process engine", runtimeService.getVariable(procInst.getId(), "myVar"));

myVar is set by the delegateExpressionBean. The Variables are empty as soon I have this expression on the workflow.

Error - which also only happens if I have this expression on the workflow:


SCHWERWIEGEND: EXCEPTION: org.activiti.engine.ActivitiException: execution 4 doesn't exist
org.activiti.engine.ActivitiException: execution 4 doesn't exist
   at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(GetExecutionVariableCmd.java:52)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:102)
   at org.activiti.spring.test.servicetask.ServiceTaskSpringDelegationTest.testDelegateExpression(ServiceTaskSpringDelegationTest.java:32)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at junit.framework.TestCase.runTest(TestCase.java:168)
   at org.activiti.engine.impl.test.PvmTestCase.runTest(PvmTestCase.java:75)
   at junit.framework.TestCase.runBare(TestCase.java:134)


Any Ideas?

Thanks,

Puel

Outcomes