I hava camunda 7 spring boot project and I call java delegation to do some logic, in locally env every thing working fine, but one we deploy in dev env by on cluster we received this message once process call java delegation :
ENGINE-09008 Exception while instantiating class ‘org.camunda.bpm.extension.keycloak.showcase.task.CamtDelegate’: ENGINE-09017 Cannot load class ‘org.camunda.bpm.extension.keycloak.showcase.task.CamtDelegate’: org.camunda.bpm.extension.keycloak.showcase.task.CamtDelegate
Hi @aravindhrs
Unfortunately, I am quite sure that the class’s path is correct, but unfortunately it does not work yet. What is really strange is that the same project and the same workflow work well on the local environment, but it does not work on the development environment.
There is also another strange thing, which is that if we put the process .bpmn in this path “src/resource ” we will not find it on the cikpit page.
We still need to urgent support because the project delivery date is approaching.
Hi @aravindhrs, thank you for quick responce.
I’m so sorry, I can’t share with you project code in GitHub because it’s exist in private network for remote control code.
I will share with you our code here.
We use this Camunda release :
And we didn’t add any thing else, we just create a new java delegation class to call it as a service task in the process.
This is cmtDelegatoin class:
package org.camunda.bpm.extension.keycloak.showcase.task;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.http.HttpHeaders;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.HashMap;
public class CamtDelegate implements JavaDelegate {
// private final Logger LOGGER = Logger.getLogger(camtDelegate.class.getName());
@Override
public void execute(DelegateExecution execution) throws Exception {
String sla = null;
ArrayList factoryList = (ArrayList) execution.getVariables().get("slaList");
HashMap slaMap = (HashMap) factoryList.get(0);
switch(execution.getVariable("status").toString()) {
case "inA":
sla = "PT"+slaMap.get("inA").toString()+"S";
break;
case "reporting":
sla = "PT"+slaMap.get("reporting").toString()+"S";
break;
case "entity":
sla = "PT"+slaMap.get("entity").toString()+"S";
break;
case "EntityF":
sla = "PT"+slaMap.get("EntityF").toString()+"S";
break;
case "reportA":
sla = "PT"+slaMap.get("reportA").toString()+"S";
break;
default:
}
execution.setVariable("timerValue", sla);
}
}
When it’s working on your local environment is you can download the required all the dependencies for your project as it needs(Keycloak and related jars).
When you deploy the code to server(Kubernetes), it may not reach to the internet and download the required jar files and hence class is not found, error is thrown.
Two options.
Package all the required jars inside the code and do the deployment.
Put the jars in shareable directory and read that directory as volume mount.
Check with your infra team, to make sure that vulnerability test is passed to deploy the code.