Not able to access process variables

Hello,
I am trying to access java object in 3 different service tasks, in below manner,

I have 3 service task,

  1. GetConfiguration – Here i am using below line of code ,

ObjectValue actionsDataValue = Variables.objectValue(actions).create();
processEngine.getRuntimeService().setVariableLocal(execution.getId(), “actions”, actionsDataValue);

  1. ProcessInitiationMail - accessing “actions” object and i am able to get the object

ObjectValue objAction = processEngine.getRuntimeService().getVariableTyped(execution.getId(),“actions”,false);
List actions = (List) objAction.getValue();

  1. ProcessComplitionMail - Here also i am using same code as above ,but in this service task I am getting below error,
    org.camunda.bpm.engine.rest.exception.ExceptionHandler.toResponse java.lang.IllegalStateException: Object is not deserialized.

    Any idea what is going wrong?

Hi @anjumaara3,

Could you please post your process model? Also, if you have an automated test case at hand that you could publish on github, that would be very helpful.

Cheers,
Thorben

Ah, never mind, I think I see what is going wrong :slight_smile:

In your second code example, you have the line ObjectValue objAction = processEngine.getRuntimeService().getVariableTyped(execution.getId(),“actions”,false);. The last parameter tells the engine whether to deserialize the variable on retrieval or not. Make sure to set that parameter to true in order to avoid the exception.

Hi Thorben,
Thanks for the reply :slight_smile:
I tried by setting 3rd parameter to true and also by removing it but,ended with below error,

org.camunda.bpm.engine.rest.exception.RestExceptionHandler.toResponse org.camunda.bpm.engine.rest.exception.RestException: Cannot submit task form f3f966c2-db34-11e7-acbf-0a0027000004: Cannot deserialize object in variable ‘actions’: ENGINE-09017 Cannot load class ‘com.ordervu.model.Action’: com.ordervu.model.Action

Here is bpmn file orderValidate.bpmn (11.4 KB)

Thanks,
Anjum