There was an exception while invoking the TaskListener. Message: 'Unknown property used in expression: ${TaskAssignmentListener}. Cause: Cannot resolve identifier 'TaskAssignmentListener''

Hi Team,

I have built a Camunda Spring Boot Application and if I try to run that, I am able to achieve what is intended, whereas If I try to run Camunda-BPM-Run 7.15 and after configuring my BPMN process within the resources folder of Camunda-BPM-Run, the BPMN diagram is getting successfully deployed but If I try to start the process I am getting the below exception.

The process could not be started. : Cannot instantiate process definition modeler-process:8:9ae7c921-21ed-11ec-a9cf-00059a3c7a00: ENGINE-03051 There was an exception while invoking the TaskListener. Message: 'Unknown property used in expression: ${TaskAssignmentListener}. Cause: Cannot resolve identifier ‘TaskAssignmentListener’'

I have attached my BPMN diagram as well the runnable spring boot application file.

NOTE-> It works fine if I try to run the spring boot application, not on camunda bpm-run.

Can Someone please help?

Thanks in advance


‘TaskAssignmentListener’'process.bpmn (6.4 KB)

I noticed that the bean name is taskAssignmentListener while the class is called TaskAssignmentListener Could it be the mis-matched cases?

dg

Hi @davidgs , As per me that should not be the scenario since within the delegate expression I am using the correct bean name which has been assigned. Even though, I tried making the class name similar to bean name but still no luck.

Hi @davidgs , could it be because my code is not getting deployed properly? I have placed my .war file within the webapps folder as well as within rest folder of camunda BPM Run and have placed my BPMN file within the resources folder.

Hi @Akash_01,

What @davidgs meant is to use the expression
${taskAssignmentListener} instead of ${TaskAssignmentListener}

1 Like

Hi @hassang , Yes I did the same but no luck.

Hi @Akash_01 ,

I am not 100% sure how the @Bean annotation in Spring works. But have you tried to use @Named annotation?

If you use @Named you have to make sure that in your expression you start with lowercase. If your classname is TaskAssignmentListener your Expression should be ${taskAssignmentListener}

Let me know if that works
Kind regards
Nele

This seems like a popular thread! :slight_smile:
I might just join in!

With Camunda Run you need to make sure that you deploy your beans and business logic into the lib folder. I’m not sure how you’ve deployed your bean but it might be in the wrong place.

1 Like

Hi @Akash_01,

Where is the implementation of TaskAssignmentListener?

Does it implement TaskListener interface?

Why not to implement it in a separate class and annotate with @Component

1 Like

Hi @Niall , Yes, I have placed my war file within the userlib folder and the BPMN diagram within resources folder, and have placed my war file within webapps folder as well( read somewhere that’s why), but no luck. As per me, I feel so it could be in the wrong place but really not sure what am I missing here.

Note-> The same code is working fine If I try to run my Camunda Spring Boot Application i.e. without Camunda BPM Run.

Since I need to push my code further within upper envs, I have to do it through Camunda run.

Hi @hassang ,Yes I am using TaskListener Interface.

Hi @Akash_01,

Okay…

By running this code in Camunda Run, you are mixing up things (Spring Boot Application to be run in Camunda Run which is based on Spring Boot)

Below link might be of help to you

1 Like

Ran into the same problem. I gave up on using beans and specified the Java Class name instead. But even that was not enough. My Camunda Java Delegates and ExecutionListeners were defined in a different package. I had to add an @Cmponent annotation to my Listener. Also had to add an @ComponentScan annotation to my Spring application class and specify the base packages names for all the foreign packages in that annotation:

package com.x.y;

@SpringBootApplication
@ComponentScan(basePackages = {"com.a.b", "com.x.y"})
public class Application {
  ...
}
package com.a.b;

@Component
public class InvocationListener implements ExecutionListener {
    ---
}

This seemed to make the classes visible in the Spring Context. I would have thought the @Bean annotation would have done that, but in my case it did not.

Also, if your listener is in a different jar file than your Spring Boot application class, you cannot use the spring-boot-maven-plugin in your pom.xml build settings. This re-writes the jar and prevents the spring application from finding your classes in the referenced jar file. Remove this from your pom.xml if your listener is in a different jar:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

That is all that I have got for you.