How to get custom variable in a delegateExecution

Hi, I have a simple process.

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?

Here is my debug

Hi @Marat,

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 continuations before or after an activity.

Configuring asynchronous continuations before 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

<serviceTask id="service1" name="Generate Invoice" camunda:asyncBefore="true" camunda:class="my.custom.Delegate" />

Thanks a lot for your answer! Unfortunately, it didn’t help me. My custom variable is still empty.
Here my service


And here my variable class

public class MKDPpoInfo implements Serializable{
protected String orderObjectId;
protected String address;
protected String seriesTypeBuilding;
protected String wallMaterial;
protected Integer apartmentAmount;
protected Integer fisMeterToChangeAmount;
protected Integer onePhasesAmount;
protected Integer threePhasesAmount;
protected Integer odpuMeterToChangeAmount;

protected String voorman;
protected String master;
protected String manager;

protected Date executionDate;

protected Integer entranceAmount;
protected Integer vruCount;
protected Integer floorGreatestAmount;
protected Integer floorLeastAmount;
protected String puInstallationPlace;
protected String electricFacilityCondition;
protected String loftPresence;
protected String gsmLoftlevel;
protected String gsmShieldlevel;
protected Integer gatewayAmount;
protected Integer routerAmount;
protected Integer entranceNumber;
protected Integer floorAmount;
protected Integer flatFirstFloorAmount;
protected String flatsPerEntrance;
protected List<Entrance> entrances = new ArrayList<>();
protected String workCheck;
protected Date plannedPpoDate;
protected Date orderPpoDate;
protected String ppoClaimStatus;
protected String claimFailReason;
protected String managerComment;
protected String voormanComment;

public String getVoormanComment() {
    return voormanComment;
}

public void setVoormanComment(String voormanComment) {
    this.voormanComment = voormanComment;
}

public String getManagerComment() {
    return managerComment;
}

public void setManagerComment(String managerComment) {
    this.managerComment = managerComment;
}

public String getClaimFailReason() {
    return claimFailReason;
}

public void setClaimFailReason(String claimFailReason) {
    this.claimFailReason = claimFailReason;
}

public String getPpoClaimStatus() {
    return ppoClaimStatus;
}

public void setPpoClaimStatus(String ppoClaimStatus) {
    this.ppoClaimStatus = ppoClaimStatus;
}

public String getManager() {
    return manager;
}

public void setManager(String manager) {
    this.manager = manager;
}

public Date getOrderPpoDate() {
    return orderPpoDate;
}

public void setOrderPpoDate(Date orderPpoDate) {
    this.orderPpoDate = orderPpoDate;
}

public Date getPlannedPpoDate() {
    return plannedPpoDate;
}

public void setPlannedPpoDate(Date plannedPpoDate) {
    this.plannedPpoDate = plannedPpoDate;
}

public String getWorkCheck() {
    return workCheck;
}

public void setWorkCheck(String workCheck) {
    this.workCheck = workCheck;
}

public List<Entrance> getEntrances() {
    return entrances;
}

public void setEntrances(List<Entrance> entrances) {
    this.entrances = entrances;
}

public String getBlockPrecence() {
    return blockPrecence;
}

public void setBlockPrecence(String blockPrecence) {
    this.blockPrecence = blockPrecence;
}

protected String blockPrecence
        ;
public String getFlatsPerEntrance() {
    return flatsPerEntrance;
}

public void setFlatsPerEntrance(String flatsPerEntrance) {
    this.flatsPerEntrance = flatsPerEntrance;
}

public Integer getFlatFirstFloorAmount() {
    return flatFirstFloorAmount;
}

public void setFlatFirstFloorAmount(Integer flatFirstFloorAmount) {
    this.flatFirstFloorAmount = flatFirstFloorAmount;
}

public Integer getFloorAmount() {
    return floorAmount;
}

public void setFloorAmount(Integer floorAmount) {
    this.floorAmount = floorAmount;
}

public Integer getEntranceNumber() {
    return entranceNumber;
}

public void setEntranceNumber(Integer entranceNumber) {
    this.entranceNumber = entranceNumber;
}

public Integer getRouterAmount() {
    return routerAmount;
}

public void setRouterAmount(Integer routerAmount) {
    this.routerAmount = routerAmount;
}

public Integer getGatewayAmount() {
    return gatewayAmount;
}

public void setGatewayAmount(Integer gatewayAmount) {
    this.gatewayAmount = gatewayAmount;
}

public String getGsmShieldlevel() {
    return gsmShieldlevel;
}

public void setGsmShieldlevel(String gsmShieldlevel) {
    this.gsmShieldlevel = gsmShieldlevel;
}

public String getGsmLoftlevel() {
    return gsmLoftlevel;
}

public void setGsmLoftlevel(String gsmLoftlevel) {
    this.gsmLoftlevel = gsmLoftlevel;
}

public String getLoftPresence() {
    return loftPresence;
}

public void setLoftPresence(String loftPresence) {
    this.loftPresence = loftPresence;
}

public String getElectricFacilityCondition() {
    return electricFacilityCondition;
}

public void setElectricFacilityCondition(String electricFacilityCondition) {
    this.electricFacilityCondition = electricFacilityCondition;
}

public String getPuInstallationPlace() {
    return puInstallationPlace;
}

public void setPuInstallationPlace(String puInstallationPlace) {
    this.puInstallationPlace = puInstallationPlace;
}

public Integer getFloorLeastAmount() {
    return floorLeastAmount;
}

public void setFloorLeastAmount(Integer floorLeastAmount) {
    this.floorLeastAmount = floorLeastAmount;
}

public Integer getFloorGreatestAmount() {
    return floorGreatestAmount;
}

public void setFloorGreatestAmount(Integer floorGreatestAmount) {
    this.floorGreatestAmount = floorGreatestAmount;
}

public Integer getVruCount() {
    return vruCount;
}

public void setVruCount(Integer vruCount) {
    this.vruCount = vruCount;
}

public String getVoorman() {
    return voorman;
}

public void setVoorman(String voorman) {
    this.voorman = voorman;
}

public String getMaster() {
    return master;
}

public void setMaster(String master) {
    this.master = master;
}

public String getOrderObjectId() {
    return orderObjectId;
}

public void setOrderObjectId(String orderObjectId) {
    this.orderObjectId = orderObjectId;
}

public String getAddress() {
    return address;
}

public void setAddress(String address) {
    this.address = address;
}

public String getSeriesTypeBuilding() {
    return seriesTypeBuilding;
}

public void setSeriesTypeBuilding(String seriesTypeBuilding) {
    this.seriesTypeBuilding = seriesTypeBuilding;
}

public String getWallMaterial() {
    return wallMaterial;
}

public void setWallMaterial(String wallMaterial) {
    this.wallMaterial = wallMaterial;
}

public Integer getApartmentAmount() {
    return apartmentAmount;
}

public void setApartmentAmount(Integer apartmentAmount) {
    this.apartmentAmount = apartmentAmount;
}

public Integer getFisMeterToChangeAmount() {
    return fisMeterToChangeAmount;
}

public void setFisMeterToChangeAmount(Integer fisMeterToChangeAmount) {
    this.fisMeterToChangeAmount = fisMeterToChangeAmount;
}

public Integer getOnePhasesAmount() {
    return onePhasesAmount;
}

public void setOnePhasesAmount(Integer onePhasesAmount) {
    this.onePhasesAmount = onePhasesAmount;
}

public Integer getThreePhasesAmount() {
    return threePhasesAmount;
}

public void setThreePhasesAmount(Integer threePhasesAmount) {
    this.threePhasesAmount = threePhasesAmount;
}

public Integer getOdpuMeterToChangeAmount() {
    return odpuMeterToChangeAmount;
}

public void setOdpuMeterToChangeAmount(Integer odpuMeterToChangeAmount) {
    this.odpuMeterToChangeAmount = odpuMeterToChangeAmount;
}

public Date getExecutionDate() {
    return executionDate;
}

public void setExecutionDate(Date executionDate) {
    this.executionDate = executionDate;
}

public Integer getEntranceAmount() {
    return entranceAmount;
}

public void setEntranceAmount(Integer entranceAmount) {
    this.entranceAmount = entranceAmount;
}

}

If you would have any idea I would be happy to hear it.
Thank you in advance.

Here is my HTML form on a case if it needed

Задание на обследование дома
<script cam-script type="text/form-script">

inject([’$rootScope’, function($rootScope) {
$scope.userName = $rootScope.authentication.name;
}]);
var mkdPpoInfo = $scope.mkdPpoInfo = {
entrances : []
};

<!-- script -->

camForm.on(‘form-loaded’, function() {
camForm.variableManager.createVariable({
name: ‘application’,
type: ‘Object’,
value: mkdPpoInfo,
valueInfo: {
serializationDataFormat: ‘application/json’,
objectTypeName: ‘ru.sec2.model.MKDPpoInfo’
}
});
});

<body class="bg-light">

<h2 class="mb-3">Исходные данные по объекту</h2>
<div class="mb-3">
    <label for="orderObjectId">ID Объекта сдачи </label>
    <input type="text" class="form-control" id="orderObjectId" ng-model="mkdPpoInfo.orderObjectId" required>
</div>
<div class="mb-3">
    <label for="address">Адрес </label>
    <input type="text" class="form-control" id="address" placeholder="Улицу и номер дома"
           ng-model="mkdPpoInfo.address" required>
</div>
<div class="mb-3">
    <label for="manager">Менеджер проекта</label>
    <input class="form-control" id="manager" cam-variable-type="String" cam-variable-name="manager" ng-model="mkdPpoInfo.manager"
           type="text" required>
</div>
<div class="mb-3">
    <label for="plannedPpoDate">Плановая дата проведения работ</label>
    <p class="input-group">

        <input type="text"
               ng-model="mkdPpoInfo.plannedPpoDate"
               id="plannedPpoDate"
               class="form-control"
               required
               uib-datepicker-popup="yyyy-MM-dd'T'HH:mm:ss"
               datepicker-options="dateOptions"
               cam-variable-name="plannedPpoDate"
               cam-variable-type="Date"
               ng-required="true"
               clear-text="Сбросить"
               close-text="Закрыть"
               current-text="Сегодня"
               language="ru"
               is-open="plannedPpoDateOpened"/>

        <span class="input-group-btn">
<button type="button"
        class="btn btn-default"
        ng-click="openplannedPpoDate($event)">
  <i class="glyphicon glyphicon-calendar"></i >
</button>
</div>
<div class="row justify-content-center">
    <div class="col-md-3">
        <label for="seriesTypeBuilding">Серия, тип постройки</label>
        <input class="form-control" id="seriesTypeBuilding" ng-model="mkdPpoInfo.seriesTypeBuilding"
               type="text" required value="22">
    </div>
    <!-- исключение -->
    <div class="col-md-3">
        <label for="wallMaterial">Материал несущих стен</label>
        <select id="wallMaterial" class="form-control" ng-model="mkdPpoInfo.wallMaterial" required >
            <option value="панельные" selected>Панельные</option>
            <option value="кирпичные">Кирпичные</option>
        </select>
    </div>
    <div class="col-md-3">
        <label for="apartmentAmount">Кол-во квартир в доме</label>
        <input class="form-control" id="apartmentAmount" ng-model="mkdPpoInfo.apartmentAmount"
               type="number" required value="33">
    </div>
</div>
<!--  -->
<h4 class="mb-3">Приборы учета</h4>
<div class="row justify-content-center">
    <div class="col-md-3"><label for="onePhasesAmount">1Ф</label>
        <input class="form-control" id="onePhasesAmount" ng-model="mkdPpoInfo.onePhasesAmount"
               type="number" required value="33">
    </div>
    <div class="col-md-3">
        <label for="threePhasesAmount">3Ф</label>
        <input class="form-control" id="threePhasesAmount" ng-model="mkdPpoInfo.threePhasesAmount"
               type="number" required value="33">
    </div>
    <div class="col-md-3">
        <label for="odpuMeterToChangeAmount">Кол-во ОДПУ под замену</label>
        <input class="form-control" id="odpuMeterToChangeAmount"
               ng-model="mkdPpoInfo.odpuMeterToChangeAmount"
               type="number" required value="33">
    </div>
    <div class="col-md-3">
        <label for="fisMeterToChangeAmount">Кол-во ПУ ФЛ для замены</label>
        <input class="form-control" id="fisMeterToChangeAmount"
               ng-model="mkdPpoInfo.fisMeterToChangeAmount"
               type="number" required value="33">
    </div>
</div>
<!-- конец одинаковой части -->

<div class="form-group">
    <label for="voorman">Выбрать бригадира</label>
    <input class="form-control" id="voorman" cam-variable-type="String" cam-variable-name="voorman" ng-model="mkdPpoInfo.voorman"
           type="text" required value="d">
</div>

</body>
</html>

Hi @Marat,

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 @Marat,

Are you using an embedded process engine? If yes then you need to enable the job executor since it is disabled by default.

For asynchronous continuations to work, job executor should be enabled.

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

Hi @Marat,

Please have a look at below docs (Java Object API)

com.example.Order retrievedOrder = (com.example.Order) runtimeService.getVariable(execution.getId(), "order");

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.

Hi @Marat,

I am talking about the cast when getting the variable not about serialization.

Have you managed to check whether job executor is enabled or not?

@marat, No need to change the “serializationDataFormat” from “application/json” to “application/x-java-serialized-object”.

Lets consider that you stored the custom variable application value as serialized json string with serializationDataFormat as “application/json”.

And here’s the code to convert serialized json value to custom object:

JsonValue jsonValue = execution.getVariableTyped("tenantActivationStatus");

TenantActivationStatus tenantActivationStatus = JSON(jsonValue.getValueSerialized())
        .mapTo(TenantActivationStatus.class);

Make sure spin dependencies in the classpath.

Thanks for yor answer the project didn’t have a spin dependensies:

org.camunda.spin camunda-spin-dataformat-json-jackson 1.10.0

Now, this code works properly:

@Override
public void execute(DelegateExecution execution) throws Exception {
TestObject testObject = (TestObject)execution.getVariable(“testObject”);
if (testObject == null)
System.out.println(“Object is null”);
else
System.out.println("Object name is " + testObject.getName());
}

1 Like

Thank you very much for you help. The problem is over.