Error Boundary Event no longer catch java thrown BpmnError

Hi,
It seems that my thrown bpmnError from JavaDelegate is no longer catched by the Error Boundary Event. This occurs after my upgrade from camunda 7.5 to 7.8. Has there been a change in the api / bpmn syntax that could have this effect on an existing bpmn file?

Process with Boundary Event
image

Settings in Modeler

Java Code that throws the error.

catch (Exception e) {
                if (errorCounter == 3) {
                    if (throwErrors) {
                        logger.warn("THROWS BPMN Error MI_100");
                        throw new BpmnError("MI_100", e.getMessage());
                    }
                }
}

I can see in my log the the logger message → logger.warn(“THROWS BPMN Error MI_100”); will be executed after the third try. Then the “cmd:114 - ENGINE-13011 closing existing command context” error appears.

> 2018-07-10 14:25:57 WARN  GeneratePlot:225 - Number of PLOT_ERROR_TRIES for Process ID [14443] is = 3
> 2018-07-10 14:25:57 WARN  GeneratePlot:239 - THROWS BPMN Error MI_100
> 2018-07-10 14:25:57 DEBUG GeneratePlot:246 - FINAL BLOCK OF GENERATE PLOT
> 2018-07-10 14:25:57 ERROR context:156 - ENGINE-16006 BPMN Stack Trace:
> 	[name_replaced]_generatePlots (activity-execute, ScopeExecution[14497])
> 	[name_replaced]_generatePlots, name=Generierung Plots
> 
> 2018-07-10 14:25:57 DEBUG cmd:114 - ENGINE-13011 closing existing command context
> 2018-07-10 14:25:57 ERROR context:156 - ENGINE-16004 Exception while closing command context: Error Message is null
> org.camunda.bpm.engine.ProcessEngineException: Error Message is null
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 	at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:344)
> 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
> 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotEmpty(EnsureUtil.java:95)
> 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotEmpty(EnsureUtil.java:91)
> 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotEmpty(EnsureUtil.java:83)
> 	at org.camunda.bpm.engine.delegate.BpmnError.setMessage(BpmnError.java:67)
> 	at org.camunda.bpm.engine.delegate.BpmnError.<init>(BpmnError.java:50)
> 	at [name_replaced].GeneratePlot.execute(GeneratePlot.java:240)

The only thing I have changed during the update was to comment out the FoxFailedJobParseListener , as mentioned in the update guide.

<bean class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration"
		id="processEngineConfiguration">
		<property name="processEngineName" value="default" />
		<property name="dataSource" ref="dataSourceCamundaBpm" />
		<property name="transactionManager" ref="transactionManagerCamundaBpm" />
		<property name="databaseSchemaUpdate" value="false" />
		<property name="jobExecutorActivate" value="true" />
		<property name="jobExecutor" ref="cbpmSpringJobExecutor" />
		<property name="jobExecutorAcquireByPriority" value="true" />
		<property name="jobExecutorAcquireByDueDate" value="false" />
		<property name="jobExecutorPreferTimerJobs" value="false" />
		<!-- <property name="customPostBPMNParseListeners">
			<list>
				<bean
					class="org.camunda.bpm.engine.impl.bpmn.parser.FoxFailedJobParseListener" />
			</list>
		</property>
		<property name="failedJobCommandFactory" ref="foxFailedJobCommandFactory" /> -->
		<property name="dmnEngineConfiguration">
			<bean class="org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration">
				<property name="defaultInputExpressionExpressionLanguage"
					value="juel" />
			</bean>
		</property>
		<property name="deploymentResources"
			value="#{camundaDeployService.readBpmDeploymentFiles()}" />
		<!--  is used instead of <property name="deploymentResources" value="classpath*:bpmn/*/*.bpmn"/> -->
	</bean>

Anybody an idea why it is no longer working?

Hi Christoph,

Check this property enableExceptionsAfterUnhandledBpmnError

P.S.: Also I think that failedJobCommandFactory is not need any more as well.

Best regards,
Yana

Thanks for your answer. I’ll give it a try.

1. Config

Quote from your Link

It can happens that no catching boundary event was defined for an error event

Isn’t it exectly what I do? Define the error

MI_100

and trigger it with

throw new BpmnError("MI_100", e.getMessage());


  1. failedJobCommandFactory

P.S.: Also I think that failedJobCommandFactory is not need any more as well.

It is commented (not active). Sorry because of multi-line comment difficult to see.

<property name="enableExceptionsAfterUnhandledBpmnError" value="true"/>

in the processEngineConfiguration won’t work for me.

The error message did not change.

2018-07-11 12:12:02 DEBUG cmd:114 - ENGINE-13011 closing existing command context
2018-07-11 12:12:02 ERROR context:156 - ENGINE-16004 Exception while closing command context: Error Message is null
org.camunda.bpm.engine.ProcessEngineException: Error Message is null

For me it sounds like the throw BpmnError is not correct and therefore the message is null.

I am sorry, I will check it again

Nothing to be sorry for! You try to help me!

Could you share an example so I can try it locally?

I try to get away from my complex process an made an easy one.
There it works fine. I throw an error that get caught bei ErrorBoundary Event.

Process
image

Definied Boundary Event

Throw Error
try {
throw new Exception(“Test”);
}
catch (Exception e) {
logger.error(e, e);
throw new BpmnError(“MI_100”,“TestMitMessage”);
}

I let it run on the same engine as the complex process and it works fine. So it cannot be a problem with the camunda version change or my camunda settings.

Now i have to find out why it did not work in my complex process. I guess I will remove the error boundary event and the error itself and define a new one. Maybe that helps.

@Yana
Thanks so far.

Hey cweb,

would you bother to try the vPAV and see if the BoundaryErrorChecker gives you any helpful hints?

Hope this helps you to figure out the problem.

Best regards
Sascha

Thanks for the hint but I found the mistake yet. I’ll maybe check out the validator later if I have a bit more time.

I found the reason for my exception.

The exception

2018-07-11 12:12:02 ERROR context:156 - ENGINE-16004 Exception while closing command context: Error Message is null
org.camunda.bpm.engine.ProcessEngineException: Error Message is null

doesen’t mean that my BpmnError is null. The message attribute of my BpmnError object was null.

throw new BpmnError(“MI_100”, e.getMessage()); // e.getMessage() was null.

So the java code throws the error and the boundary event was catching it, but then an error occured because of the null value. I thougt all the time it would not be catched.

:exclamation: The strange thing is that the exact code worked for more than a year with camunda 7.5. The error occurs only in camunda 7.8.

If there are any issue with the Exception handling in java then this type of error appears, There is only one option to solve this, to clear the Query, and select the boundary again, if you want to know the process in details, Bitdefender update error will help you to suggest all the information.

is ‘Generierung Plots’ an external task in your model ? the reason i’m asking this is because i have a similar model where i added the error boundary event on the external task, and in a particular scenario i am throwing the BpmnError but i’m getting null error. The reason i think is, the error boundary event details show something different in my case i don’t see Error Name, Erro code etc., all i see is global error referenced, Name and code on the boundary error event details panel.