Camunda Rest API Doesn't work

Hi,
I’ve been searching for a fix for this issue, yet I can’t fix it. I already tried changing the camunda versions from 7.17, 14, 16 and 19 and yet it doesnt’ work.

A snipper of my Gradle dependency is as follows. Can anyone help me work to access camunda Rest APIs?

plugins {
    id 'idea'
    id 'java'
    id 'maven-publish'
    id 'org.springframework.boot' version '2.5.8'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'com.github.spotbugs' version '4.7.1' apply false
    id 'pmd'
}

configurations{
    compileOnly {
        extendsFrom annotationProcessor
    }
}
configurations.all {

    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.requested.group == 'org.apache.thrift' && details.requested.name == 'libthrift' && details.requested.version == '0.11.0') {
            details.useVersion '0.15.0'
            details.because 'fixes critical vlunerability in 0.11.0'
        }
        if (details.requested.group == 'org.apache.commons' && details.requested.name == 'commons-compress' && details.requested.version == '1.20') {
            details.useVersion '1.21'
            details.because 'fixes critical vlunerability in 1.20'
        }
        if (details.requested.group == 'org.glassfish.jersey.core' && details.requested.version == '2.33') {
            details.useVersion '2.34'
            details.because 'fixes critical vlunerability in 2.33'
        }
        if (details.requested.group == 'org.glassfish.jersey.ext'  && details.requested.version == '2.33') {
            details.useVersion '2.34'
            details.because 'fixes critical vlunerability in 2.33'
        }
        if (details.requested.group == 'org.bouncycastle' && details.requested.name == 'bcprov-jdk15on' && details.requested.version == '1.59') {
            details.useVersion '1.70'
            details.because 'fixes critical vlunerability in 1.59'
        }
        if (details.requested.group == 'org.apache.camel' && details.requested.name == 'camel-core' && details.requested.version == '2.22.0') {
            details.useVersion '3.14.0'
            details.because 'fixes critical vlunerability in 2.22.0'
        }


    }
}

repositories {
    mavenLocal()
    mavenCentral()
     maven {
        url 'http://<DOMAIN>/nexus/content/repositories/<HIDDEN>-central'
    }
    maven { url "https://<DOMAIN>/nexus/content/repositories/PaymentHub_Snapshot" }
    maven { url "https://<DOMAIN>/nexus/content/repositories/PaymentHub_Releases" }
    maven { url 'http://<DOMAIN>/nexus/content/repositories/CBR_Releases' }
    maven { url 'http://<DOMAIN>/nexus/content/repositories/CBR_Snapshot' }
}

dependencies {

    compile 'com.<HIDDEN>.bpg.paymenthub:payment-hub-common:2.0.3.12-SNAPSHOT'

    compile 'com.h2database:h2:1.4.200'
    compile 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8'
    compile 'com.zaxxer:HikariCP:3.4.1'
    compile 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:7.17.0'
    compile 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:7.17.0'
    compile 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-test:7.17.0'
    compile 'org.camunda.bpm:camunda-eng.<HIDDEN>ine-plugin-spin:7.17.0'
    compile 'org.camunda.spin:camunda-spin-core:1.18.1'
    compile 'org.camunda.spin:camunda-spin-dataformat-json-jackson:1.18.1'
    compile 'org.springframework.boot:spring-boot-starter-security'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.5'
    compile 'io.jsonwebtoken:jjwt:0.9.1'
    implementation 'org.apache.commons:commons-collections4:4.4'
    implementation 'com.oracle.database.jdbc:ojdbc8:21.7.0.0'

    compile 'org.springframework.kafka:spring-kafka:2.8.1'
    compileOnly 'org.projectlombok:lombok:1.18.20'
    annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
    annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
    annotationProcessor 'org.projectlombok:lombok:1.18.20'

    testCompileOnly 'org.projectlombok:lombok:1.18.20'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'

    implementation (group: 'com.<HIDDEN>.bpg.csp', name: 'web-common', version:"2.1.0"){
        exclude group:'javax.validation', module:'validation-api'
        exclude group: 'com.<HIDDEN>.bpg', module: 'jaeger-common'
    }
    implementation group: 'ch.qos.logback', name: 'logback-classic'
    implementation 'ch.qos.logback:logback-classic:1.2.10'
    implementation 'ch.qos.logback.contrib:logback-jackson:0.1.5'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'

    compile 'org.springframework.retry:spring-retry:1.2.5.RELEASE'
    compile 'org.springframework:spring-aspects:5.2.8.RELEASE'

    implementation 'org.mapstruct:mapstruct:1.4.2.Final'
    annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'

    implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
}

ext {
    set('springCloudVersion', "2020.0.5")
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

group = 'com.<HIDDEN>.bpg.paymenthub'
version = projectVersion
sourceCompatibility = '1.8'

publishing {
    publications {
        maven(MavenPublication) {
            from(components.java)
        }
    }
}

bootJar {
    baseName = projectName
    group = group
    version = version
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

apply plugin: 'checkstyle'
checkstyle {
    toolVersion = '7.8.1'
    checkstyleTest.enabled = false
    configFile = file("config/checkstyle/checkstyle.xml")
}
checkstyleMain {
    source = 'src/main/java'
}

apply plugin: 'com.github.spotbugs'
spotbugs {
    spotbugsTest.enabled = false
    ignoreFailures = false
    showStackTraces = true
    showProgress = true
    effort = 'max'
    reportsDir = file("$buildDir/spotbugs")
    excludeFilter = file("config/spotbugs/spotbugs_exclude.xml")
}

tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
    reports {
        html {
            enabled = true
        }
    }
}

pmd {
    sourceSets = [sourceSets.main]
    ruleSetFiles = files("config/pmd/pmd.xml")
    ruleSets = []
    ignoreFailures = false
}

BPMN File

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1rrow5o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.13.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
  <bpmn:process id="tadc-sff-translation-process" name="tadc-sff-translation-process" isExecutable="true">
    <bpmn:sequenceFlow id="Flow_1767kan" sourceRef="StartEvent_1" targetRef="Activity_106br0o" />
    <bpmn:startEvent id="StartEvent_1" name="Start Message Event">
      <bpmn:extensionElements>
        <camunda:formData>
          <camunda:formField id="inputSource" label="inputSource" type="string" />
          <camunda:formField id="paymentHubId" label="paymentHubId" type="string" />
        </camunda:formData>
      </bpmn:extensionElements>
      <bpmn:outgoing>Flow_1767kan</bpmn:outgoing>
      <bpmn:messageEventDefinition id="MessageEventDefinition_0od7ejz" messageRef="Message_0f7tl8p" />
    </bpmn:startEvent>
    <bpmn:serviceTask id="Activity_106br0o" name="TADC SFF Task" camunda:asyncBefore="true" camunda:asyncAfter="true" camunda:type="external" camunda:topic="tadcSff-topic">
      <bpmn:extensionElements>
        <camunda:executionListener class="com.cwt.bpg.paymenthub.delegate.TaskListener" event="start">
          <camunda:field name="processStatus">
            <camunda:expression>Started</camunda:expression>
          </camunda:field>
        </camunda:executionListener>
        <camunda:executionListener class="com.cwt.bpg.paymenthub.delegate.TaskListener" event="end">
          <camunda:field name="processStatus">
            <camunda:string>Finished</camunda:string>
          </camunda:field>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1767kan</bpmn:incoming>
      <bpmn:outgoing>Flow_13m69lo</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:boundaryEvent id="Event_1d83r4k" attachedToRef="Activity_106br0o">
      <bpmn:extensionElements>
        <camunda:executionListener class="com.cwt.bpg.paymenthub.delegate.TaskListener" event="start">
          <camunda:field name="processStatus">
            <camunda:expression>Failed</camunda:expression>
          </camunda:field>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:outgoing>Flow_16h4qsb</bpmn:outgoing>
      <bpmn:errorEventDefinition id="ErrorEventDefinition_1tx2sac" errorRef="Error_1fu5f6d" />
    </bpmn:boundaryEvent>
    <bpmn:sequenceFlow id="Flow_16h4qsb" sourceRef="Event_1d83r4k" targetRef="Activity_0e87iy9" />
    <bpmn:serviceTask id="Activity_0e87iy9" name="TADC SFF Validation Error" camunda:class="com.cwt.bpg.paymenthub.delegate.ValidationErrorDelegate">
      <bpmn:incoming>Flow_16h4qsb</bpmn:incoming>
      <bpmn:outgoing>Flow_0drhu8q</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="Event_1gfazvr">
      <bpmn:incoming>Flow_0drhu8q</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0drhu8q" sourceRef="Activity_0e87iy9" targetRef="Event_1gfazvr" />
    <bpmn:endEvent id="Event_1c8ak6d">
      <bpmn:incoming>Flow_13m69lo</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_13m69lo" sourceRef="Activity_106br0o" targetRef="Event_1c8ak6d" />
    <bpmn:subProcess id="Activity_1u1j6lt" name="TADC SFF Default Catch All Process" triggeredByEvent="true">
      <bpmn:extensionElements>
        <camunda:executionListener class="com.cwt.bpg.paymenthub.delegate.TaskListener" event="start">
          <camunda:field name="processStatus">
            <camunda:string>Failed</camunda:string>
          </camunda:field>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:startEvent id="Event_18rq3ue" name="Error Start Event">
        <bpmn:outgoing>Flow_03yxiu2</bpmn:outgoing>
        <bpmn:errorEventDefinition id="ErrorEventDefinition_1k5y9dw" errorRef="Error_005q9j2" />
      </bpmn:startEvent>
      <bpmn:sequenceFlow id="Flow_03yxiu2" sourceRef="Event_18rq3ue" targetRef="Activity_1pxfbee" />
      <bpmn:endEvent id="Event_0qptzl2">
        <bpmn:incoming>Flow_0c4c71v</bpmn:incoming>
      </bpmn:endEvent>
      <bpmn:sequenceFlow id="Flow_0c4c71v" sourceRef="Activity_1pxfbee" targetRef="Event_0qptzl2" />
      <bpmn:serviceTask id="Activity_1pxfbee" name="Create service now Incident" camunda:type="external" camunda:topic="translator-service-now-topic">
        <bpmn:incoming>Flow_03yxiu2</bpmn:incoming>
        <bpmn:outgoing>Flow_0c4c71v</bpmn:outgoing>
      </bpmn:serviceTask>
    </bpmn:subProcess>
  </bpmn:process>
  <bpmn:message id="Message_0f7tl8p" name="tadc-sff-translator-workflow" />
  <bpmn:error id="Error_005q9j2" name="GENERIC_ERROR" errorCode="GENERIC_ERROR" />
  <bpmn:error id="Error_1fu5f6d" name="VALIDATION" errorCode="VALIDATION" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="tadc-sff-translation-process">
      <bpmndi:BPMNShape id="Event_1aa5da3_di" bpmnElement="StartEvent_1">
        <dc:Bounds x="179" y="99" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="162" y="142" width="72" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1n18ls2_di" bpmnElement="Activity_106br0o">
        <dc:Bounds x="428" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0uzsttr_di" bpmnElement="Activity_0e87iy9">
        <dc:Bounds x="590" y="190" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1gfazvr_di" bpmnElement="Event_1gfazvr">
        <dc:Bounds x="792" y="212" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1c8ak6d_di" bpmnElement="Event_1c8ak6d">
        <dc:Bounds x="792" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_101vu5y_di" bpmnElement="Activity_1u1j6lt" isExpanded="true">
        <dc:Bounds x="300" y="330" width="492" height="220" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0zkm8n2_di" bpmnElement="Event_18rq3ue">
        <dc:Bounds x="342" y="422" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="319" y="465" width="83" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0qptzl2_di" bpmnElement="Event_0qptzl2">
        <dc:Bounds x="692" y="422" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0gxmaz3_di" bpmnElement="Activity_1pxfbee">
        <dc:Bounds x="491" y="400" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_03yxiu2_di" bpmnElement="Flow_03yxiu2">
        <di:waypoint x="378" y="440" />
        <di:waypoint x="491" y="440" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0c4c71v_di" bpmnElement="Flow_0c4c71v">
        <di:waypoint x="591" y="440" />
        <di:waypoint x="692" y="440" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Event_1c37y6s_di" bpmnElement="Event_1d83r4k">
        <dc:Bounds x="457" y="139" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1767kan_di" bpmnElement="Flow_1767kan">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="428" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_16h4qsb_di" bpmnElement="Flow_16h4qsb">
        <di:waypoint x="475" y="175" />
        <di:waypoint x="475" y="230" />
        <di:waypoint x="590" y="230" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0drhu8q_di" bpmnElement="Flow_0drhu8q">
        <di:waypoint x="690" y="230" />
        <di:waypoint x="792" y="230" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_13m69lo_di" bpmnElement="Flow_13m69lo">
        <di:waypoint x="528" y="117" />
        <di:waypoint x="792" y="117" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Workflow Config

@Log
@Component
public class TadcSffTranslatorWorkflow extends WorkflowEngineProcessor<String> {

    public static final String PROCESSOR_WORKFLOW_NAME = "tadc-sff-translator-workflow";

    public TadcSffTranslatorWorkflow() {
        super(PROCESSOR_WORKFLOW_NAME);
    }
}

Hello friend!

Can you access the “webapps”?
Can you run the camunda application on your localhost and call the APIs through postman or insomnia?

If you have any better details to provide (logs… error messages… or other) it will help us to come up with a solution.

William Robert Alves

please do share your full POM.xml

I shared a snippet of my gradle file fyr. thx.

I could run the application if I change the workflow name from tadc-sff-translator-workflow to something new or unique. but after sometime of debugging as I also change some config, this supposedly new workflow name is now erroring out too so I have to change it again to something new and so on.

There are no errors on the logs if I am running it with a new workflow name, though in terms of accessing the web app, I could access it up until the homepage, but when I open the Cockpit,Tasklist or Admin pages, it just loads for eternity. Even with that, there are no errors being thrown in the logs.

What I am trying to do really is try to delete old deployments of process definitions which is erroring out on our original working code, it just doesnt work on my local machine due to this duplicate error of sort, hence I am trying to access the Camunda Rest APIs to hopefully remove this old process defs deployments but apparently, it doesn’t work yet for some reason. :confused:

Hello my friend!

I have some ideas that might be affecting… I could be wrong, but come on…

In the midst of so much code, I saw that you have a “configurations.all”, which serves to replace some dependencies and mitigate possible vulnerabilities, perhaps one of the problems that is occurring may be dependency conflicts.

You mentioned that when you try to open any of the webapps (cockpit, admin or tasklist), it keeps loading for eternity… this behavior usually happens due to some failure in the database, which can be an overloaded database, connection pool, or problems similar.

Check if you can directly access your Camunda database, and take a look at the act_ru_execution and other tables to see if there’s an overload or something like that.

Despite not being recommended, you can run a query on the database to exclude the implemented processDefinitions, or instances that may be causing a problem.

OBS.: Don’t forget to make a backup of your database before any changes that may affect the operation of the application.

I hope this helps.
William Robert Alves

I was not aware of this Camunda Database, I didn’t even knew act_ru_execution in my local h2 database is for Camunda. If any, would it be possible to reset this database used by Camunda?. I just want it to be reset so that the microservice could run on my local machine as it does with other devs in our team who did not change this workflow names.

I’ll be checking this configurations.all for now. thx.

Yes, Camunda has a database where it stores a lot of information (seriously… A LOT!), such as the task each instance is in, active instances, jobs that are running, deployed processDefinitions and even history about everything that has happened in Camunda since deployment, if you haven’t set a history storage level other than the default (full), or if you haven’t set up a history cleanup.

But yes, you can reset your database just like any other database.

If you are using h2 in local environment, you can search h2.db file and delete.

As soon as you bring up camunda again, the tables will be recreated, but empty.

Any questions I’m available to help!

See you later!
William Robert Alves

Hi, thanks, I deleted all this database tables related to camunda with prefix of act_**** . I am now able to run our microservices locally with the original code and I no longer received duplicate messages/events when starting the microservice. My main problem now resolved with regards to the startup issue and also the reason why I am trying to access the Camunda Rest APIs.

I also temporarily deleted configurations.all configs. However, I could still not access the cockpits, admin pages etc as well as the camunda Rest API, though I have little to no need of the Camunda Rest API already but would be great to have for future purposes, alas it still doesnt work. I still can’t use the web app. I did clear the browser caches already and retained the original code where it works in our dev env, but it wont just run on my local machine,does Camunda Rest API somehow do a more cleaner way to reset this tables or configs locally?. As it seems that I still have some sort of localy config issue remaining. One thing I am sure really is that this same code already works in our dev env, just not the Camunda Rest API really as I also tried accessing this apis in our dev env, yet i cant access it there too.

1 Like

Excellent! :smile:

I’m happy to be able to help!

and your other problem, instead of just deleting the execution tables, maybe a solution would be to delete the h2.db file and restart from scratch, or zero all tables to see if the problem continues…

If you can send us a print of your computer screen accessing Camunda through the browser to try to understand better what is happening.

When you put your camunda project to run locally, and make a call via postman or insomnia, what happens?

what answer do you get?

Can you send us a print of this too?

William Robert Alves

I already tried deleting the h2 db file and had to re-execute some basic insert scripts for our ms. however, my camunda web app still can’t open cockpit, admin pages etc. I only see the welcome screen. seen below.

And this is what happens when I open the cockpit pages

This is the behavior of this same code in our dev env.

Hence it baffles me what else did I not removed. I also tried re-cloning my repository, yet the issue persist.

As for the postman or insomnia thing, I am not sure about this as for all I know we work with batch jobs hence I could not trigger any api via the microservice. Whats insomnia pertaining to and how I could access it?.

I also tried checking the network logs, and this is what I am seeing.


I am not sure why it is throwing 404 on some js and css scripts, this is something I have no control of at best afaik.

Huuuuum… :thinking: :thinking: :thinking:

Try running a mvn clean and mvn install

also try clearing your browser’s cache, or accessing camunda cockpit in an incognito window, to check the behavior.

If it doesn’t work, ask a colleague of yours to test it on his machine, to see if the same thing will happen… if it works on his computer, we’ll know that the problem is in your local environment (your computer.)

William Robert Alves

Ye, I assume this is really 100% on my local environments issue, however, despite being able to do mvn clean install, reclone the repo, and clear browser cache or run in incognito, the issue persisted. I have no idea what else to delete or what else is causing this issue. I just resorted to switching to my personal computer atm to be able to run our microservice since I I could not make it work on my work laptop. :confused: