DelegateExpression not loading listener class

Hi,

I have created executable process using fluent api and configured camundalistner class on start event as below.

builder.startEvent().name(“start event”).id(“startEvent”).camundaExecutionListenerDelegateExpression(“start”,"#{startProcessListener}")…so on

and following is the execution listener class :

@Service(“startProcessListener”)
public class StartProcessListener implements ExecutionListener {

@Override
public void notify(DelegateExecution execution) throws Exception {
	// TODO Auto-generated method stub
	
	System.out.println("inside  StartProcessListener ############################");
}

}

when i am trying to instantiate process it is giving me following error :
**Cannot instantiate process definition MainProcess:1:b21e999b-b988-11e7-81d9-5cb901b3ce2a: Unknown property used in expression: #{startProcessListener}. Cause: Cannot resolve identifier ‘startProcessListener’

Also i have tried @Component for listener class that is also not working.

can anybody guide me issue please.

Hi @milindk,
try to use dollar sign ($) instead of #.

This test looks similar to yours: https://github.com/camunda/camunda-bpm-platform/blob/master/engine-spring/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/ProcessInstanceModificationInTransactionTest.java

Hi @sdorokhova,

Tried as suggested by you getting following error.

org.camunda.bpm.engine.rest.exception.RestException: Cannot instantiate process definition MainProcess:1:e58af77e-bd37-11e7-a660-5cb901b3ce2a: Unknown property used in expression: ${startProcessListener}. Cause: Cannot resolve identifier

I think this is related to some jar/config issue. All ExecutionListener/JavaDelegate class not able to convert in spring bean.
Do you know which camunda jar do this functionality? Any suggestion

Hi @sdorokhova,
can you please suggest some solution to fix issue.

Hi @milindk,
sorry I don’t get, why it’s not working. Can you may be post some minimal sample project, reproducing the problem?

The only idea that I have, is the order in which Spring creates beans. From where do you call create process code? Can it be that at this moment your listener bean is not yet created by Spring?

My partial snippet of project pom as below:

org.springframework.boot spring-boot-starter-parent 1.5.2.RELEASE
<properties>
	<java.version>1.8</java.version>
	<camunda.version>7.7.0</camunda.version>
</properties>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.camunda.bpm</groupId>
			<artifactId>camunda-bom</artifactId>
			<version>${camunda.version}</version>
			<scope>import</scope>
			<type>pom</type>
		</dependency>
		<dependency>
			<groupId>org.camunda.bpm.dmn</groupId>
			<artifactId>camunda-engine-dmn-bom</artifactId>
			<version>${camunda.version}</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

<dependencies>
	<dependency>
		<!-- process engine, needs to be provided -->
		<groupId>org.camunda.bpm</groupId>
		<artifactId>camunda-engine</artifactId>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<!-- decision engine -->
		<groupId>org.camunda.bpm.dmn</groupId>
		<artifactId>camunda-engine-dmn</artifactId>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>org.camunda.bpm</groupId>
		 <artifactId>camunda-engine-spring</artifactId>
		<!--  <scope>provided</scope> -->
	</dependency>

. …

scenario is that i am deploying some process using SpringServletProcessApplication. Using java api i am defining main process and calling deployed process as part of main process.

Below is my camunda configuration:

@Configuration
public class BpmApplicationWebConfig extends WebMvcConfigurerAdapter {

@Autowired
private Environment env;

@Bean
public ProcessEngineService processEngineService() {
  return BpmPlatform.getProcessEngineService();
}


@Bean
public SpringServletProcessApplication processApplication() {
  return new OrderVuProcessApplication();
}



@Bean(destroyMethod = "toString")
public ProcessEngine processEngine() throws Exception {
  return processEngineService().getDefaultProcessEngine();
}

@Bean
public RepositoryService repositoryService() throws Exception {
  return processEngine().getRepositoryService();
}


@Bean
public RuntimeService runtimeService() throws Exception {
  return processEngine().getRuntimeService();
}


@Bean
public TaskService taskService() throws Exception {
  return processEngine().getTaskService();
}


@Bean
public HistoryService historyService() throws Exception {
  return processEngine().getHistoryService();
}


@Bean
public ManagementService managementService() throws Exception {
  return processEngine().getManagementService();
}


@Bean
public IdentityService identityService() throws Exception {
  return processEngine().getIdentityService();
}

@Bean
public AuthorizationService authorizationService() throws Exception {
  return processEngine().getAuthorizationService();
}

}

I think this should give some information about my configuration and requirement.