Error flushing statements when completing process

When my process completes, I am getting the following stack trace. Can someone please tell me what the problem is. Thanks in advance.

1-Feb-2019 11:00:23.761 SEVERE [pool-2-thread-1] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing comman
d context: ENGINE-03083 Exception while executing Batch Database Operations with message ’

Error flushing statements. Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.Hist

oricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: NULL not allo
wed for column “NAME_”; SQL statement:
insert into ACT_HI_VARINST (
ID_,
PROC_DEF_KEY_,
PROC_DEF_ID_,
ROOT_PROC_INST_ID_,
PROC_INST_ID_,
EXECUTION_ID_,
ACT_INST_ID_,
TENANT_ID_,
CASE_DEF_KEY_,
CASE_DEF_ID_,
CASE_INST_ID_,
CASE_EXECUTION_ID_,
TASK_ID_,
NAME_,
REV_,
VAR_TYPE_,
CREATE_TIME_,
REMOVAL_TIME_,
BYTEARRAY_ID_,
DOUBLE_,
LONG_,
TEXT_,
TEXT2_,
STATE_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?
) [23502-190]

Cause: org.apache.ibatis.executor.BatchExecutorException: org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance (batch index #1) failed. Cause: org.h2.jdbc.JdbcBatchUpdateException: NULL not allowed for column “NAME_”; SQL statement:

insert into ACT_HI_VARINST (
ID_,
PROC_DEF_KEY_,
PROC_DEF_ID_,
ROOT_PROC_INST_ID_,
PROC_INST_ID_,
EXECUTION_ID_,
ACT_INST_ID_,
TENANT_ID_,
CASE_DEF_KEY_,
CASE_DEF_ID_,
CASE_INST_ID_,
CASE_EXECUTION_ID_,
TASK_ID_,
NAME_,
REV_,
VAR_TYPE_,
CREATE_TIME_,
REMOVAL_TIME_,
BYTEARRAY_ID_,
DOUBLE_,
LONG_,
TEXT_,
TEXT2_,
STATE_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,

Could you please upload an example how to reproduce the issue.

I have found the issue. It was caused when the process tried to save a variable that had the value NULL. (ie. delegateExecution.setVariable(‘someVar’, null);

Thanks.

@alexencompass,

I am also facing the same issue after changing my project from spring mvc to spring boot. Can you pls help if you can spot in which direction I should work. exact same is working in another framework.