Getting ProcessEngineException after updating to 7.6.12

Good morning,

after updating from 7.6.4 to 7.6.12 I’m getting a ProcessEngineException with the message “org.camunda.bpm.engine.ProcessEngineException: ENGINE-03041 Cannot work with serializers outside of command context.”

org.camunda.bpm.engine.ProcessEngineException: ENGINE-03041 Cannot work with serializers outside of command context.
	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.serializerOutOfContextException(EnginePersistenceLogger.java:381)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getSerializers(TypedValueField.java:208)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.ensureSerializerInitialized(TypedValueField.java:184)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getSerializer(TypedValueField.java:178)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:93)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:79)
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getValue(TypedValueField.java:70)
	at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.getValue(VariableInstanceEntity.java:250)
	at com.anwendung.services.ProzessEngineCommandContext.leseProzessVariablen(ProzessEngineCommandContext.java:202) 
[...]

The method in which the exception is thrown. variable.getValue() != null is line 202, mentioned in the stacktrace.

public Table<String, String, Object> leseProzessVariablen(Set<String> processInstanceIds) {
    List<VariableInstance> variablen =
        getAdvancedTaskService().createFastVariablenQuery().selectVariableInstanceShort(
            new ArrayList<String>(processInstanceIds));

    Table<String, String, Object> table = HashBasedTable.create();
    for (VariableInstance variableInstance : variablen) {
        if (variableInstance.getValue() != null) {
            table.put(variableInstance.getProcessInstanceId(), variableInstance.getName(), variableInstance.getValue());
        }
    }

    return table;
} 

The method selectVariableInstanceShort:

@Override
public List<VariableInstance> selectVariableInstanceShort(final List<String> processInstanceIds) {
        return commandExecutor.execute(new Command<List<VariableInstance>>() {
            @Override
            public List<VariableInstance> execute(CommandContext commandContext) {
                final List<VariableInstance> list =
                    commandContext.getDbSqlSession().getSqlSession()
                        .selectList("selectVariableInstanceShortByProcessInstanceIds", processInstanceIds);

                for (VariableInstance v : list) {
                    ((VariableInstanceEntity) v).postLoad();
                }
                return list;
            }

        });
    }

which uses the following mapper:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity">


  <!-- VARIABLE INSTANCE RESULTMAP -->

	<resultMap id="variableInstanceResultMap" type="org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity">
      <result property="serializerName" column="TYPE_" javaType="String" jdbcType="VARCHAR"/>
      <result property="name" column="NAME_" javaType="String" jdbcType="VARCHAR" />
      <result property="processInstanceId" column="PROC_INST_ID_" jdbcType="VARCHAR" />
      <result property="textValue" column="TEXT_" jdbcType="VARCHAR"/>
      <result property="longValue" column="LONG_" jdbcType="BIGINT"/>
	</resultMap>

  <!-- VARIABLE INSTANCE SELECT -->

	<select id="selectVariableInstanceShortByProcessInstanceIds" parameterType="java.util.List" resultMap="variableInstanceResultMap">
		select TYPE_, NAME_, PROC_INST_ID_, TEXT_, LONG_  from ${prefix}ACT_RU_VARIABLE where
		    <!-- processInstanceIds -->
           	PROC_INST_ID_ in
            <foreach item="item" index="index" collection="list"
                     open="(" separator="," close=")">
              #{item}
            </foreach>
  	</select>

</mapper>

We are using a shared process engine running on websphere 8.5 application server and DB2 on z/OS.

Any suggestions are highly appreciated.

Regards
Simon

During debugging we recognized that the class TypedValueField has changed its postLoad() method. Prior to 7.6.4, the new version is missing the call to ensureSerializerInitialized(). The new postLoad() is simply empty.

Regards
Simon

As you seem to be an enterprise user, I recommend raising a support ticket with this question.

Cheers,
Thorben