# "activity is null" & "message is null"

**URL:** <https://forum.camunda.io/t/activity-is-null-message-is-null/47573>\
**Category:** Camunda 7 Topics\
**Tags:** process-engine, spring-boot-starter\
**Created:** [September 15, 2023, 4:42pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573 "2023-09-15T16:42:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wseaford](https://forum.camunda.io/letter_avatar_proxy/v4/letter/w/3e96dc/32.png) [@wseaford](https://forum.camunda.io/u/wseaford)\
**Post date:** [September 15, 2023, 4:42pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/1 "2023-09-15T16:42:47Z")

</div>

Hi, in the past few weeks my Camunda process has been getting two specific incidents rising in cockpit

_Cannot invoke “org.camunda.bpm.engine.impl.pvm.process.ActivityImpl.isAsyncBefore()” because “activity” is null_  
and  
_message is null_

Here is the exception stack trace for the first one.

```auto
14-Sep 09:46:17.350 ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: Cannot invoke "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl.isAsyncBefore()" because "activity" is null
java.lang.NullPointerException: Cannot invoke "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl.isAsyncBefore()" because "activity" is null
	at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.isAsync(LegacyBehavior.java:541)
	at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.repairMultiInstanceAsyncJob(LegacyBehavior.java:570)
	at org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:67)
	at org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:40)
	at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:133)
	at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:110)
	at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:43)
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:72)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:70)
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
	at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
	at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

```

For the other error I get even less information

```auto
15-Sep 16:15:09.023 ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: null
java.lang.NullPointerException: null

```

So far I have:

- checked each activity in the bpmn has an id and name using modeler.
- checked each activity has their asynchronous continuations before, after & exclusive checked.
- went into Deployments and deleted past process definitions and checked they were no longer in the database (ACT\_RE\_PROCDEF).

These two errors still persist, It’s difficult for me to know which activity is sparking the incidents as the incident happens on the call activity. When I go into the process which the call activity passes to from cockpit then no incident or process is seen. Only viewable from the main pool.

Would anybody be able to shed light on what is happening and why?

---

<div class="post-metadata">

**Author:** ![WilliamR.Alves](https://forum.camunda.io/user_avatar/forum.camunda.io/williamr.alves/32/27412_2.png) [@WilliamR.Alves](https://forum.camunda.io/u/WilliamR.Alves)\
**Post date:** [September 15, 2023, 4:46pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/2 "2023-09-15T16:46:07Z")

</div>

Hello my friend!

Can you share your process flow with us?

**William Robert Alves**

---

<div class="post-metadata">

**Author:** ![wseaford](https://forum.camunda.io/letter_avatar_proxy/v4/letter/w/3e96dc/32.png) [@wseaford](https://forum.camunda.io/u/wseaford)\
**Post date:** [September 22, 2023, 10:01pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/3 "2023-09-22T22:01:11Z")

</div>

Didn’t quite find the root cause but we found a solution in setting up a retry policy as R10/PT5M.

---

<div class="post-metadata">

**Author:** ![WilliamR.Alves](https://forum.camunda.io/user_avatar/forum.camunda.io/williamr.alves/32/27412_2.png) [@WilliamR.Alves](https://forum.camunda.io/u/WilliamR.Alves)\
**Post date:** [September 22, 2023, 11:02pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/4 "2023-09-22T23:02:02Z")

</div>

Great, but i imagine that in this activity you are calling some service, right?

My suggestion is that you check the root cause, as treating a nullPointerException by increasing retries will drastically increase the number of attempted calls to your service, and even “dirty” your logs.

If you increased the number of retries and resolved, probably in the context of your application, at the moment the instance arrives at this activity, the instance still does not have the object or variable necessary for execution, and then as time and attempts run out , your process has time for the object or variable to be loaded into the process and then it is possible to execute this activity.

Or something is trying to start this task, without it being definitively prepared for this at the time it is called.

If you want to share your process or part of it that may be causing this error, I can help you with a definitive solution.

**William Robert Alves**

---

<div class="post-metadata">

**Author:** ![ahuet](https://forum.camunda.io/user_avatar/forum.camunda.io/ahuet/32/26890_2.png) [@ahuet](https://forum.camunda.io/u/ahuet)\
**Post date:** [September 27, 2023, 1:28pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/5 "2023-09-27T13:28:04Z")

</div>

Hello,

I’ve encountered a similar issue after a migration from version 7.16 to 7.18. I can share two stacktrace but the root cause is the same, one when starting a workflow:

> ! java.lang.NullPointerException: Cannot invoke “org.camunda.bpm.engine.impl.pvm.process.ActivityImpl.isAsyncBefore()” because “activity” is null  
> ! at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.isAsync(LegacyBehavior.java:541)  
> ! at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.migrateMultiInstanceJobDefinitions(LegacyBehavior.java:533)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.updateJobDeclarations(BpmnDeployer.java:184)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.definitionAddedToDeploymentCache(BpmnDeployer.java:139)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.definitionAddedToDeploymentCache(BpmnDeployer.java:71)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.registerDefinition(AbstractDefinitionDeployer.java:293)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.handlePersistedDefinition(AbstractDefinitionDeployer.java:245)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.handlePersistedDefinition(BpmnDeployer.java:162)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.handlePersistedDefinition(BpmnDeployer.java:71)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.loadDefinitions(AbstractDefinitionDeployer.java:237)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.postProcessDefinitions(AbstractDefinitionDeployer.java:206)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.deploy(AbstractDefinitionDeployer.java:66)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$2.call(CacheDeployer.java:66)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$2.call(CacheDeployer.java:63)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:559)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:547)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer.deployOnlyGivenResourcesOfDeployment(CacheDeployer.java:63)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.ResourceDefinitionCache.resolveDefinition(ResourceDefinitionCache.java:124)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.ResourceDefinitionCache.findDeployedDefinitionById(ResourceDefinitionCache.java:56)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache.findDeployedProcessDefinitionById(DeploymentCache.java:81)  
> ! at org.camunda.bpm.engine.impl.runtime.DefaultCorrelationHandler.correlateStartMessageByEventSubscription(DefaultCorrelationHandler.java:176)  
> ! at org.camunda.bpm.engine.impl.runtime.DefaultCorrelationHandler.correlateStartMessages(DefaultCorrelationHandler.java:155)  
> ! at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd$1.call(CorrelateMessageCmd.java:70)  
> ! at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd$1.call(CorrelateMessageCmd.java:68)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:559)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:547)  
> ! at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:68)  
> ! at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:42)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)  
> ! at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:71)  
> ! at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)  
> ! at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:71)  
> ! at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)  
> ! at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)  
> ! at org.camunda.bpm.engine.impl.interceptor.ExceptionCodeInterceptor.execute(ExceptionCodeInterceptor.java:55)  
> ! at org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl.execute(MessageCorrelationBuilderImpl.java:322)  
> ! at org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl.correlateWithResult(MessageCorrelationBuilderImpl.java:233)  
> ! at org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl.correlateStartMessage(MessageCorrelationBuilderImpl.java:292)  
> ! at org.camunda.bpm.engine.impl.RuntimeServiceImpl.startProcessInstanceByMessage(RuntimeServiceImpl.java:600)

And second when calling the rest api to get the user tasks:

> ! java.lang.NullPointerException: Cannot invoke “org.camunda.bpm.engine.impl.pvm.process.ActivityImpl.isAsyncBefore()” because “activity” is null  
> ! at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.isAsync(LegacyBehavior.java:541)  
> ! at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.migrateMultiInstanceJobDefinitions(LegacyBehavior.java:533)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.updateJobDeclarations(BpmnDeployer.java:184)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.definitionAddedToDeploymentCache(BpmnDeployer.java:139)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.definitionAddedToDeploymentCache(BpmnDeployer.java:71)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.registerDefinition(AbstractDefinitionDeployer.java:293)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.handlePersistedDefinition(AbstractDefinitionDeployer.java:245)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.handlePersistedDefinition(BpmnDeployer.java:162)  
> ! at org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.handlePersistedDefinition(BpmnDeployer.java:71)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.loadDefinitions(AbstractDefinitionDeployer.java:237)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.postProcessDefinitions(AbstractDefinitionDeployer.java:206)  
> ! at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.deploy(AbstractDefinitionDeployer.java:66)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$2.call(CacheDeployer.java:66)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$2.call(CacheDeployer.java:63)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:559)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:547)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer.deployOnlyGivenResourcesOfDeployment(CacheDeployer.java:63)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.ResourceDefinitionCache.resolveDefinition(ResourceDefinitionCache.java:124)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.ResourceDefinitionCache.findDeployedDefinitionById(ResourceDefinitionCache.java:56)  
> ! at org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache.findDeployedProcessDefinitionById(DeploymentCache.java:81)  
> ! at org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.getTaskDefinition(TaskEntity.java:1320)  
> ! at org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.initializeFormKey(TaskEntity.java:1429)  
> ! at org.camunda.bpm.engine.impl.TaskQueryImpl.executeList(TaskQueryImpl.java:1440)  
> ! at org.camunda.bpm.engine.impl.AbstractQuery.evaluateExpressionsAndExecuteList(AbstractQuery.java:219)  
> ! at org.camunda.bpm.engine.impl.AbstractQuery.execute(AbstractQuery.java:193)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)  
> ! at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:71)  
> ! at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)  
> ! at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:71)  
> ! at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)  
> ! at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)  
> ! at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)  
> ! at org.camunda.bpm.engine.impl.interceptor.ExceptionCodeInterceptor.execute(ExceptionCodeInterceptor.java:55)  
> ! at org.camunda.bpm.engine.impl.AbstractQuery.executeResult(AbstractQuery.java:160)  
> ! at org.camunda.bpm.engine.impl.AbstractQuery.list(AbstractQuery.java:142)  
> ! at org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.executeTaskQuery(TaskRestServiceImpl.java:116)  
> ! at org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.queryTasks(TaskRestServiceImpl.java:96)  
> ! at org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.getJsonTasks(TaskRestServiceImpl.java:71)  
> ! at org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.getTasks(TaskRestServiceImpl.java:60)

When I access the workflow definition with the cockpit, I got the same error with message: **Failed to display process definition** \*\*:\*\*Received 500 from server.

And when I access a second time to the workflow definition, it works. It looks like an issue with the cache. Any clue ? Could it be due to bad data in the database, or a bug while building the java objects ?

Best regards,  
Alexandre

---

<div class="post-metadata">

**Author:** ![Sreenidhi\_KS](https://forum.camunda.io/user_avatar/forum.camunda.io/sreenidhi_ks/32/26675_2.png) [@Sreenidhi\_KS](https://forum.camunda.io/u/Sreenidhi_KS)\
**Post date:** [April 3, 2024, 11:40am UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/6 "2024-04-03T11:40:04Z")

</div>

Hey @ahuet,  
How did you resolve this issue? What was the reason? Can you help with the fix as well? Facing a similar issue. TIA

---

<div class="post-metadata">

**Author:** ![ahuet](https://forum.camunda.io/user_avatar/forum.camunda.io/ahuet/32/26890_2.png) [@ahuet](https://forum.camunda.io/u/ahuet)\
**Post date:** [April 3, 2024, 12:07pm UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/7 "2024-04-03T12:07:41Z")

</div>

Hello,

There was a unknown property in a bpmn, a messageEventDefinition had the xml property: camunda:async=“true”, probably due to a bad copy/paste or maybe an older version of Camunda, I don’t know.

I have removed the property and also for existing jobs, I have deleted the entries in database as MessageEventDefinition should not be in this table:

delete from ACT\_RU\_JOBDEF where act\_id\_ like ‘%MessageEventDefinition%’

Hope it helps.

Alexandre

---

<div class="post-metadata">

**Author:** ![Sreenidhi\_KS](https://forum.camunda.io/user_avatar/forum.camunda.io/sreenidhi_ks/32/26675_2.png) [@Sreenidhi\_KS](https://forum.camunda.io/u/Sreenidhi_KS)\
**Post date:** [April 4, 2024, 8:45am UTC](https://forum.camunda.io/t/activity-is-null-message-is-null/47573/8 "2024-04-04T08:45:41Z")

</div>

Thanks for the quick reply, @ahuet ! Much appreciated. Will check this out.
