where I use a ServiceTask with an implementation of JavaDelegate. In the method executed(DelegateExecution execution) I get all variables properly except for one with key “application” which is a Java Object variable.
@Named
public class ConsigningToYodaService implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
Object object = execution.getVariable("application");
if (object == null)
System.out.println("Object is null");
else
System.out.println("Object is not null");
}
This code always prints “Object is null” but this variable is not null because I get it in the next humanTasks where I can receive data which was written in a previous task.
So, in the code, I have a variable with the key “application” but it is empty.
As far as I understand, I have to somehow fetch this variable. Could you help me, please?
User Tasks are wait states and considered as transaction boundaries where the process state is stored to the database. In other words, when execution reaches to a wait state the engine persists the current execution to the database.
On the other hand, Service Tasks are non-wait states but we still can control transaction boundaries through configuring asynchronous continuationsbefore or after an activity.
Configuring asynchronous continuationsbefore the service task will let the engine persists the current execution to the database and that way the process variable “application” would be available in the implementation of the service task.
Use camunda:asyncBefore attribute as in below snip of code to enable asynchronous continuation before the service task
Have you tried to start a new process after you deployed the updated process definition?
As long as the variable is accessible from the following user tasks and it has been set to a value somewhere before the service task, then this is the only thing I can think about
No, I didn’t update the process definition. I created a new one. And I tried to use both before/after and every time I created a new process for testing it.
Hi again! Thanks a lot for keeping help me in my troubles.
As far as I understand we use the default process engine.
Now I get another trace:
org.camunda.bpm.engine.ProcessEngineException: Cannot deserialize object in variable ‘application’: SPIN-PLUGIN-01002 Fallback serializer cannot handle deserialized objects
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:85) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:31) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:105) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.getTypedValue(VariableInstanceEntity.java:276) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getTypedValueFromVariableInstance(AbstractVariableScope.java:173) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getVariableTyped(AbstractVariableScope.java:159) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getVariableTyped(AbstractVariableScope.java:155) ~[camunda-engine-7.13.0.jar:7.13.0]
at ru.sec2.services.ConsigningToYodaService.execute(ConsigningToYodaService.java:20) ~[classes/:na]
at org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:40) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:58) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:92) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:63) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:55) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.performExecution(ServiceTaskJavaDelegateActivityBehavior.java:44) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.TaskActivityBehavior.execute(TaskActivityBehavior.java:69) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior$1.call(ClassDelegateActivityBehavior.java:68) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior$1.call(ClassDelegateActivityBehavior.java:65) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.executeWithErrorPropagation(AbstractBpmnActivityBehavior.java:90) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior.execute(ClassDelegateActivityBehavior.java:65) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute$2.callback(PvmAtomicOperationActivityExecute.java:61) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute$2.callback(PvmAtomicOperationActivityExecute.java:50) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.continueIfExecutionDoesNotAffectNextOperation(PvmExecutionImpl.java:1998) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:42) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:31) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:645) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:619) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$6.callback(PvmExecutionImpl.java:1937) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$6.callback(PvmExecutionImpl.java:1934) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.continueExecutionIfNotCanceled(PvmExecutionImpl.java:2004) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.dispatchDelayedEventsAndPerformOperation(PvmExecutionImpl.java:1953) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.dispatchDelayedEventsAndPerformOperation(PvmExecutionImpl.java:1934) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:60) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:30) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:66) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:76) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:654) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:629) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:76) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:654) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:629) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:76) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:654) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:629) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:111) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:645) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:619) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope.scopeCreated(PvmAtomicOperationTransitionCreateScope.java:38) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:54) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:28) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:99) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:131) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:118) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext$1.call(CommandInvocationContext.java:102) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext$1.call(CommandInvocationContext.java:100) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:48) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:121) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:132) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:206) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:100) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:86) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:76) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:81) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:40) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:128) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:110) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:43) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46) ~[camunda-engine-spring-7.13.0.jar:7.13.0]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.2.4.RELEASE.jar:5.2.4.RELEASE]
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44) ~[camunda-engine-spring-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71) ~[camunda-engine-7.13.0.jar:7.13.0]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: org.camunda.bpm.engine.ProcessEngineException: SPIN-PLUGIN-01002 Fallback serializer cannot handle deserialized objects
at org.camunda.spin.plugin.impl.SpinPluginLogger.fallbackSerializerCannotDeserializeObjects(SpinPluginLogger.java:38) ~[camunda-engine-plugin-spin-7.13.0.jar:7.13.0]
at org.camunda.spin.plugin.impl.FallbackSpinObjectValueSerializer.deserializeFromByteArray(FallbackSpinObjectValueSerializer.java:54) ~[camunda-engine-plugin-spin-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractObjectValueSerializer.deserializeFromByteArray(AbstractObjectValueSerializer.java:119) ~[camunda-engine-7.13.0.jar:7.13.0]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:83) ~[camunda-engine-7.13.0.jar:7.13.0]
… 100 common frames omitted
I had read it before and unfortunately, couldn’t find a solution. When I change “serializationDataFormat” from “application/json” to “application/x-java-serialized-object” I got this exception.