Class Not found error after deploying using API


#1

I am deploying the bpmn files into camunda using the

DeploymentBuilder

API. The bpmn files have the reference to java classes as delegates/listeners.Here is the same code I use to deploy

deploymentBuilder.addInputStream(file.getName(), new FileInputStream(outputFolder+File.separator+file.getName()));
deploymentBuilder.enableDuplicateFiltering(true).deploy().getId();

I get the class not found error for the listener classes when i run the process. I think the issue is related to the classloader, but I am not sure how to associate the deployments done using the API with the classloader.

I tried to get the

ProcessApplicationDeplymentBuilder

instead, but kind of lost how this can be done.

ProcessApplicationReference processApplicationReference = Context.getProcessEngineConfiguration().getProcessApplicationManager().getProcessApplicationForDeployment(“testapp”).getProcessApplication().getReference()

How can I load the resources using the same classloader if that is the issue?


#2

Hi @adat,

do you use a process application?

If yes, the process application should handle the class loading.

Why do you create the deployment manually via repositoryService?

Best regards,
Philipp


#3

@Philipp_Ossler

Thank you for the response.

I am implementing a feature where we need the flexibility of modifying the BPMN files out side the deployment java war file. Our processes run for long (more than a year) and there could some process changes required during that time, so is the need for updating the BPMN files without redeploying the whole java application.

I figured out the issue. The process application needs to have at least one BPMN file to register and load the related classes, so that the deployment id from it can be obtained and the new BPMN deployment can be registered against this deployment. I was missing the registration part

 managementService().registerProcessApplication(deploymentId,
				processApplicationReference);

which needs the processApplicationReference , which is obtained using this code

	public static ProcessApplicationReference processApplicationReference(){
	
	 ProcessApplicationReference processApplication = null;
	 ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine(); 
	 ProcessEngineConfigurationImpl defaultProcessEngineConfiguration = ((ProcessEngineImpl) defaultProcessEngine).getProcessEngineConfiguration(); 
	 ProcessApplicationManager defaultProcessApplicationManager = defaultProcessEngineConfiguration.getProcessApplicationManager(); 
	 Map<String, DeploymentBuilder> deployments = new HashMap<String, DeploymentBuilder>(); 
	 
	 
	 Set<String> processAppNames = BpmPlatform.getProcessApplicationService().getProcessApplicationNames();
	 
	 for (String appName : processAppNames){
		
		 ProcessApplicationInfo prossApp = BpmPlatform.getProcessApplicationService().getProcessApplicationInfo(appName);
		 List<ProcessApplicationDeploymentInfo> deplymentInfo = prossApp.getDeploymentInfo();
		 for (ProcessApplicationDeploymentInfo processApplicationDeploymentInfo :deplymentInfo){
			 
			 if (appName.equals("xyz")){
				 processApplication = defaultProcessApplicationManager.getProcessApplicationForDeployment(processApplicationDeploymentInfo.getDeploymentId()); 
								}
		 }
	 }
	 
	 return  processApplication;
}