cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti doe not trigger m event listener

amorgos
Champ in-the-making
Champ in-the-making
Hello,
i'm trying to configure in the process definition a my event listener:

<blockcode>
  <process id="buildxxx" name="Buildxxx" isExecutable="true">
    <extensionElements>
      <activiti:executionListener class="com…..SendMailTaskAssign" />
    </extensionElements>
</blockcode>
……

I start the process using the res service but my class SendMailTaskAssign is not triggered:

<blockcode>
public class SendMailTaskAssign implements ActivitiEventListener{
   @Override
   public void onEvent(ActivitiEvent ae) {
      
      ActivitiEventType type = ae.getType();
      System.out.println("SendMailTaskAssign ae.getType():"+type);
   }   

}
</blockcode>

In my log i cannot see the expected system out or ant error….

Can you help me please?
Regards
Mario
5 REPLIES 5

trademak
Star Contributor
Star Contributor
Hi Mario,

You defined the listener as an execution listener in the BPMN XML, not as an event listener.

Best regards,

amorgos
Champ in-the-making
Champ in-the-making
Thanks a lot for the response at my stupid question Smiley Happy
Now i'm receiving the following error:
ActivitiException: couldn't instantiate class com.xxxx.SendMailTaskAssign

I put the jar containing my event class in the root/lib dir of tomcat.

Any suggestion?

Thanks in advance
Mario

amorgos
Champ in-the-making
Champ in-the-making
I tried to put the jar containing my event class in WEB-INF/lib of activity-rest war and does work.
Do you know why does not work with the jar in root/lib dir of tomcat?

Thanks in advance
Mario

vasile_dirla
Star Contributor
Star Contributor
Hi,
Generically talking about tomcat class loader there could be some reasons:
1. your tomcat is configured to load classes from other path but not (root/lib)
2. your web application has a custom class loader. (probably is not your case but it also could be a reason)
3. you put this jar in a proper path (visible to the classloader but you didn't restart your tomcat in order to reload it)

As you know it's not easy to answer exactly to your question without having access to your tomcat in order to see the tomcat configs, tomcat version, logs,  etc… but these coudl be some of the reasons.

Have a look here: https://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html (maybe you already know this url, but it could be useful for the people who see this post and never read about the classloader hierarchy in tomcat)

amorgos
Champ in-the-making
Champ in-the-making
Thanks Vasile,
i'm using the same root/lib of tomcat to deploy mysql jar and does work.
But, never mind Smiley Happy
I was just curious to know if someone had my same problem but i can deploy my events in the WEB-INF/lib of activity res war.

Regards
Mario