"SignalEvent" is causing NPE

Used a Signal Event to send a signal to an event process. The signal event is being picked up by the event process. But after the event process being executed, there is NPE reported like this,


java.lang.NullPointerException: null
        at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.findExecutionForFlowScope(PvmExecutionImpl.java:1410) ~[camunda-engine-7.12.0.jar:7.12.0]
        at org.camunda.bpm.engine.impl.bpmn.helper.CompensationUtil.createEventScopeExecution(CompensationUtil.java:104) ~[camunda-engine-7.12.0.jar:7.12.0]

Here is the workflow

Here is how the logs shows the signal is being picked up and the event subprocess is triggered but resulted in NPE.

2019-12-09 11:50:56.642  INFO 60059 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 5 ms
2019-12-09 11:50:56.705 DEBUG 60059 --- [nio-8080-exec-1] c.s.camunda.message.web.StartController  : --> Starting Process-signalEventProcess.  Is customer VIP? true
2019-12-09 11:50:56.738 DEBUG 60059 --- [nio-8080-exec-1] c.s.c.message.listener.LoggingListener   : --> ENTERING: Greeting
2019-12-09 11:50:56.739  INFO 60059 --- [nio-8080-exec-1] c.s.c.message.delegate.GreetingDelegate  : --> Welcome onboard !
2019-12-09 11:50:56.739 DEBUG 60059 --- [nio-8080-exec-1] c.s.c.message.delegate.GreetingDelegate  : --> Priority ? true
2019-12-09 11:50:56.743 DEBUG 60059 --- [nio-8080-exec-1] c.s.c.message.listener.LoggingListener   : --> EXITING: Greeting
2019-12-09 11:50:56.747 DEBUG 60059 --- [nio-8080-exec-1] c.s.c.message.listener.LoggingListener   : --> ENTERING: Priority Cabinet
2019-12-09 11:50:56.748  INFO 60059 --- [nio-8080-exec-1] c.s.c.message.delegate.PriorityDelegate  : --> Business cabinet is this way.
2019-12-09 11:50:56.748 DEBUG 60059 --- [nio-8080-exec-1] c.s.c.message.listener.LoggingListener   : --> EXITING: Priority Cabinet
2019-12-09 11:50:56.756 ERROR 60059 --- [nio-8080-exec-1] org.camunda.bpm.engine.context           : ENGINE-16004 Exception while closing command context: null

java.lang.NullPointerException: null
        at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.findExecutionForFlowScope(PvmExecutionImpl.java:1410) ~[camunda-engine-7.12.0.jar:7.12.0]
        at org.camunda.bpm.engine.impl.bpmn.helper.CompensationUtil.createEventScopeExecution(CompensationUtil.java:104) ~[camunda-engine-7.12.0.jar:7.12.0]
        at org.camunda.bpm.engine.impl.bpmn.behavior.SubProcessActivityBehavior.doLeave(SubProcessActivityBehavior.java:63) ~[camunda-engine-7.12.0.jar:7.12.0]
        at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityLeave.execute(PvmAtomicOperationActivityLeave.java:56) ~[camunda-engine-7.12.0.jar:7.12.0]
       

This is how the signal is being sent

            engine
                    .getRuntimeService()
                    .createSignalEvent("priorityCabinet")
                    .send();

Figured out. It seems the activity which raises a signal must be in a separate subprocess other than Event Sub-Process.

The below flow works as expected.

Thats interesting… because that really should work without needing to put an embedded sub process around it.
I’ll need to check this in more detail myself and i’ll let you know

Even a flow like this is causing error.

Error was,

2019-12-10 10:16:41.561 ERROR 21747 --- [nio-8080-exec-1] org.camunda.bpm.engine.context           : ENGINE-16004 Exception while closing command context: Execution must be a scope execution

org.camunda.bpm.engine.ProcessEngineException: Execution must be a scope execution
        at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.createActivityExecutionMapping(PvmExecutionImpl.java:1432) ~[camunda-engine-7.12.0.jar:7.12.0]