cancel
Showing results for 
Search instead for 
Did you mean: 

Problems accessing the context variables - expression

puel
Champ in-the-making
Champ in-the-making
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
2 REPLIES 2

puel
Champ in-the-making
Champ in-the-making
Is it possible that the process get deleted and all it's properties if no task is part of the process?

<userTask id="userTask" name="Foo" />
Can I somehow else access the variables of a workflow? After it runned?

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
the history tables….