Custom Incident Handler / Process Engine Deployment Issues

I am running into issues with creating a custom issue handler, and the creation of a custom process engine which needs to happen for implementing the issue handler.

I am running on Apache-tomcat-8.0.47. Here is a link to a git containing the project I am working on:


It also comes with a zip of the tomcat server file and the log that occurs when I run the version as it currently is.

For a quick bit of information, when I run “start-camunda”, the server will stop with the error “ENGINE-08046 Found Camunda bpm platform configuration in CATALINA_BASE/CATALINA_HOME conf directory”.

The bpm_config.xml file I have currently looks like this:

<bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform ">

  <job-executor>
    <job-acquisition name="default" />
  </job-executor>

  <process-engine name="default">
    <job-acquisition>default</job-acquisition>
    <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
    <datasource>java:jdbc/ProcessEngine</datasource>

    <properties>
      <property name="history">full</property>
      <property name="databaseSchemaUpdate">true</property>
      <property name="authorizationEnabled">true</property>
      <property name="jobExecutorDeploymentAware">true</property>
      <property name="historyCleanupBatchWindowStartTime">00:01</property>
    </properties>

    <plugins>
      <!-- plugin enabling Process Application event listener support -->
      <plugin>
		<class>org.camunda.bpm.subdivisionincidents.IncidentHandlerProcessEnginePlugin</class>
		<properties>
			<property name="boost">10</property>
			<property name="maxPerformance">true</property>
			<property name="actors">akka</property>
      </plugin>
      </plugin>

      <!-- plugin enabling integration of camunda Spin -->
      <plugin>
        <class>org.camunda.spin.plugin.impl.SpinProcessEnginePlugin</class>
      </plugin>

      <!-- plugin enabling connect support -->
      <plugin>
        <class>org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin</class>
      </plugin>

    <!-- LDAP CONFIGURATION -->
    <!-- Uncomment this section in order to enable LDAP support for this process engine -->
    <!-- Adjust configuration, see ( http://docs.camunda.org/latest/guides/user-guide/#process-engine-identity-service-the-ldap-identity-service ) -->
    <!--
      <plugin>
        <class>org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin</class>
        <properties>

          <property name="serverUrl">ldaps://localhost:4334/</property>
          <property name="acceptUntrustedCertificates">false</property>
          <property name="managerDn">uid=jonny,ou=office-berlin,o=camunda,c=org</property>
          <property name="managerPassword">s3cr3t</property>

          <property name="baseDn">o=camunda,c=org</property>

          <property name="userSearchBase"></property>
          <property name="userSearchFilter">(objectclass=person)</property>

          <property name="userIdAttribute">uid</property>
          <property name="userFirstnameAttribute">cn</property>
          <property name="userLastnameAttribute">sn</property>
          <property name="userEmailAttribute">mail</property>
          <property name="userPasswordAttribute">userpassword</property>

          <property name="groupSearchBase"></property>
          <property name="groupSearchFilter">(objectclass=groupOfNames)</property>
          <property name="groupIdAttribute">cn</property>
          <property name="groupNameAttribute">cn</property>

          <property name="groupMemberAttribute">member</property>
          <property name="sortControlSupported">false</property>

        </properties>
      </plugin>
      -->

      <!-- LDAP CONFIGURATION -->
      <!-- The following plugin allows you to grant administrator authorizations to an existing LDAP user -->
      <!--
      <plugin>
        <class>org.camunda.bpm.engine.impl.plugin.AdministratorAuthorizationPlugin</class>
        <properties>
          <property name="administratorUserName">admin</property>
        </properties>
      </plugin>
      -->

    </plugins>


  </process-engine>

</bpm-platform>

I am trying to reference the method for “IncidentHandlerProcessEnginePlugin” that is moved to the webapps folder using the .war outputted by my Maven project. I believe this is the wrong place for the file, but I am unsure how to integrate it properly.

If possible, would someone be able to post a simple bare-bones example of how to set this up, including the project and file structure required to correctly link the files?

Cheers.

Hi

Perhaps this [1] will give you inspiration…

regards

Rob

[1] https://github.com/camunda-consulting/code/tree/master/snippets/email-incident-handler-plugin

1 Like

Hi @hockleya,

I assume you want to run your process on a constainer managed engine installed on a tomcat server: https://docs.camunda.org/manual/7.8/introduction/architecture/#shared-container-managed-process-engine

For this you have to seperate the process implementation from the incident handling. The process application should be packaged as a war file, the process engine plugin should be packaged as a jar file.

In Tomcat you have to deploy the process application as a normal war file. To run the process engine plugin you should copy the jar file into tomcat/lib folder and adjust the bpm-config.xml as you did it already.

Hope this helps,

Ingo

3 Likes

Hi @Ingo_Richtsmeier,

This helped a lot and solved my main issue, thank you very much! I have a much better understanding of the process engine now too.

To assist anyone who may run into these issues in future, the other steps I took were to:
*Remove the “properties” list of tags in my bpm-platform.xml file. These were causing issues for me, I am sure there is a way around it, but removing these removed the issues.

*Changed my referencing of the incident handler in EmailSender to:

		IncidentContext incidentContext = new IncidentContext();
		DelegateExecution taskExecution = delegatedTask.getExecution();
		incidentContext.setActivityId(taskExecution.getCurrentActivityId());
        incidentContext.setProcessDefinitionId(taskExecution.getProcessDefinitionId());
		incidentContext.setExecutionId(taskExecution.getId());
        Context.getProcessEngineConfiguration().getIncidentHandler("subdivision-incident").handleIncident(incidentContext, errorMessage);
    }

*Changed my handleIncident method in my SubdivisionIncidentHandler class to:

    public Incident handleIncident(IncidentContext incidentContext, String s) {
        IncidentEntity incidentEntity = (IncidentEntity) super.handleIncident(incidentContext, s);

        return incidentEntity;
    }

Big information dump but it may help someone some day.

Cheers again for all the help everyone!

Thanks for the link @Webcyberrob! This helped lots as well.