Custom incident handler & camunda server restart


I have created a custom incident handler and made a corresponding entry in bpm-platform.xml. The custom incident handler is called perfectly fine.

But, if I restart the camunda - the custom incident handler is not called and if I again redeploy the workflow (bpm.xml) and start that workflow, then again custom incident handler is called.

Let me know - if anybody faced such issue before.


How do you register the incident handler?

Every time camunda tomcat server is started , IncidentHandlerProcessEnginePlugin preinit method and getIncidentHandlerType of TestIncidentHandler is called.
But every time after the server restart - I need to deploy the workflow (bpm.xml) and start that flow to trigger the custom incident handler to be invoked.

Otherwise, if I dont deploy the workflow after the server restart - custom incident handler is not invoked. I did the following steps -

  1. created a jar with the following two classes and put in tomcat/lib.

package org.camunda.bpm.aoincidents;

import java.util.ArrayList;
import java.util.List;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;

public class IncidentHandlerProcessEnginePlugin extends AbstractProcessEnginePlugin {

  public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
	System.out.println("Inside IncidentHandlerProcessEnginePlugin preInit.");  		  
    List customIncidentHandlers = new ArrayList();
    customIncidentHandlers.add(new TestIncidentHandler());
    processEngineConfiguration.setCustomIncidentHandlers(customIncidentHandlers );	



package org.camunda.bpm.aoincidents;

import java.util.concurrent.TimeoutException;

import org.camunda.bpm.engine.impl.incident.IncidentContext;
import org.camunda.bpm.engine.impl.incident.IncidentHandler;
import org.camunda.bpm.engine.runtime.Incident;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public class TestIncidentHandler implements IncidentHandler {

public void deleteIncident(IncidentContext arg0) {
	// TODO Auto-generated method stub		

public String getIncidentHandlerType() {
	// TODO Auto-generated method stub
	System.out.printlnTestIncidentHandler getIncidentHandlerType");

public Incident handleIncident(IncidentContext arg0, String arg1) {
	// TODO Auto-generated method stub		
	System.out.println("AutomataOrchestratorIncidentHandler handleIncident");
	return null;

public void resolveIncident(IncidentContext arg0) {
	// TODO Auto-generated method stub		
  1. In bpm-platform.xml, added the following lines inside plugin & class tag.