NPE - JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0

cancel
Showing results for 
Search instead for 
Did you mean: 
Member II

NPE - JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0

We are consistently getting an NPE when running an application with all async tasks.  The errors only occur when a step is run by a SimpleAsyncTaskExecutor.  Any idea what could be causing the errors?

Here is the stack trace:

 at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:48) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29) [activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39) [activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.lockJobIfNeeded(ExecuteAsyncRunnable.java:154) [activiti-engine-6.0.0.jar!/:6.0.0]
 ERR  at org.activiti.engine.impl.persistence.entity.AbstractEntityManager.delete(AbstractEntityManager.java:87)
 ERR  at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35)
java.lang.NullPointerException: null
 at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:151) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.persistence.entity.AbstractEntityManager.delete(AbstractEntityManager.java:87) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:137) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable$3.execute(ExecuteAsyncRunnable.java:167) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:78) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) [activiti-spring-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44) [activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.persistence.entity.AbstractEntityManager.delete(AbstractEntityManager.java:82) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.asyncexecutor.DefaultJobManager.unacquire(DefaultJobManager.java:230) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable$3.execute(ExecuteAsyncRunnable.java:169) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:42) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.unacquireJob(ExecuteAsyncRunnable.java:167) [activiti-engine-6.0.0.jar!/:6.0.0]
 ERR  at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35)
 ERR  at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable$3.execute(ExecuteAsyncRunnable.java:169)
 ERR  at org.activiti.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:37)
 ERR  at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:78)
2017-09-29 12:43:48.232 ERROR 11 --- [TaskExecutor-26] o.a.e.impl.interceptor.CommandContext    : Error while closing command context
 at org.activiti.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:37) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:57) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:63) ~[activiti-engine-6.0.0.jar!/:6.0.0]
 at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [spring-tx-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
 ERR  at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:151)
 ERR  at org.activiti.engine.impl.persistence.entity.AbstractEntityManager.delete(AbstractEntityManager.java:82)
 ERR  at org.activiti.engine.impl.asyncexecutor.DefaultJobManager.unacquire(DefaultJobManager.java:230)
 ERR  at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable$3.execute(ExecuteAsyncRunnable.java:167)
 ERR  at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:57)
 ERR  at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:63)
 ERR  at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:72)
 at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) [activiti-spring-6.0.0.jar!/:6.0.0]
 ERR Exception in thread "SimpleAsyncTaskExecutor-26" java.lang.NullPointerException
 ERR  at org.activiti.engine.impl.persistence.entity.JobEntityManagerImpl.delete(JobEntityManagerImpl.java:137)
 at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:72) [activiti-engine-6.0.0.jar!/:6.0.0]
 ERR  at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:42)
 ERR  at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
 ERR  at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
 ERR  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44)
 ERR  at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.unacquireJob(ExecuteAsyncRunnable.java:167)
 ERR  at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.lockJobIfNeeded(ExecuteAsyncRunnable.java:154)
 ERR  at org.activiti.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:48)
 ERR  at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29)
 ERR  at java.lang.Thread.run(Thread.java:748)
 ERR  at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
 ERR  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39)

   Mark

2 Replies
Alfresco Employee

Re: NPE - JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0

Seems like it's trying to delete a job that doesn't exist. 

It might be that you need to play with some of the jobExecutor configurations, especially asyncJobLockTimeInMillis. There are a number of threads about nullpointerexceptions and asynchronous tasks and/or parallel continuations. It can be a tricky subject. Anything further you can share about your configuration and workflow would be useful.

You might also want to consider whether the Activiti Cloud approach of sending messages to service tasks implemented as microservices in their own runtimes might be a good fit for your usecase.

Member II

Re: NPE - JobEntityManagerImpl.delete(JobEntityManagerImpl.java:35) ~[activiti-engine-6.0.0.jar!/:6.0.0

Has there been a solution to this? If yes, please share it here.

I am facing exactly the same issue. Have tried playing around with the jobExecutor configurations, but no luck so far.