cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException on Complete Task

edufrazao
Champ on-the-rise
Champ on-the-rise
Hi folks.
Sometimes in a specific bpmn process, the task complete throws this error:


Caused by: java.lang.NullPointerException
        at org.activiti.engine.impl.variable.JPAEntityListVariableType.isAbleToStore(JPAEntityListVariableType.java:60)
        at org.activiti.engine.impl.variable.DefaultVariableTypes.findVariableType(DefaultVariableTypes.java:58)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableInstance(VariableScopeImpl.java:837)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.createVariableInstance(ExecutionEntity.java:1188)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:752)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:739)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:633)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:590)
        at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariables(VariableScopeImpl.java:534)
        at org.activiti.engine.impl.persistence.entity.TaskEntity.setExecutionVariables(TaskEntity.java:477)
        at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:46)
        at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
        at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:59)
        at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
        at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:182)


How can I debug this error to see what is causing it?
Can I set process variables with null values?

I'm using Activiti 5.21.0, but this problem occours on the 5.17.0 version too.
2 REPLIES 2

vasile_dirla
Star Contributor
Star Contributor
Hi,
For debugging you could add a breakpoint in JPAEntityListVariableType.java at line 60. (as you can see in the stacktrace)
Yes you should be able to set variables to null. (in my opinion there is an unexpected situation which leads to this NPE)
You can add some extra NPE checking in JPAEntityListVariableType.java, and create a PR with the changes.

edufrazao
Champ on-the-rise
Champ on-the-rise
Vasile, this problem occours sometimes. Always in the same process, but not with any instance. When I got it again, I will debug with this scenario, and try to build a patch. Thank you by your help.