Error to send mail



in an email connector, I would like to send an email to the contributors of a lane. A consultant came to help us and writed this code :

in the "Tools" script :

import java.util.logging.Logger;

import org.ow2.bonita.facade.IdentityAPI;
import org.ow2.bonita.facade.QueryRuntimeAPI;
import org.ow2.bonita.facade.exception.UserNotFoundException;
import org.ow2.bonita.util.AccessorUtil;
import org.ow2.bonita.facade.identity.ContactInfo;
import org.ow2.bonita.facade.runtime.TaskInstance;
import org.ow2.bonita.facade.uuid.ActivityInstanceUUID;

final Logger LOG = Logger.getLogger('org.bonitasoft.scripts.Tool');

//Get list of mail address from a list of users. Result will be formated as a String separated by commas
String listOfUserEmailSeparatedByComma(List listOfUsers){
List result=[];
for(String username:listOfUsers){
String email=null;
}catch(UserNotFoundException ex){
LOG.warning('User: '+username+' doesn\'t exist in Bonita database.');
if(email!=null && !email.isEmpty()){

return org.codehaus.groovy.runtime.DefaultGroovyMethods.join(result,',');

//Get the list of candidates of a specific task
List getTaskCandidates(ActivityInstanceUUID taskInstanceUUID){
final QueryRuntimeAPI queryRuntimeAPI=AccessorUtil.getQueryRuntimeAPI();
List result=new ArrayList();
result.addAll(new ArrayList(queryRuntimeAPI.getTaskCandidates(taskInstanceUUID)));

return result;

//Get list of mail address from the list of candidate of a task. Result will be formated as a String separated by commas
String getEmailTaskCandidates(ActivityInstanceUUID taskInstanceUUID){
List candidates=getTaskCandidates(taskInstanceUUID);
return listOfUserEmailSeparatedByComma(candidates);

And in the email connector :

${new Tools().getEmailTaskCandidates(activityInstance.getUUID())}

The code works in local but not on the development server where Talend crashes (we use Bonita in Talend) and no error in the logs.

With the Java log, we have nothing after :


As queryRuntimeAPI.getTaskCandidates() returns a Set, I tried to convert it with :

result.addAll(new ArrayList(queryRuntimeAPI.getTaskCandidates(taskInstanceUUID)));

but it doesn't work.

Thank you for you help :)


Submitted by ttoine on Wed, 11/27/2013 - 17:42

It was a Talend or Bonitasoft consultant? or someone from another company ? And can you confirm that this is about Bonita 5 ?

No answers yet.