cancel
Showing results for 
Search instead for 
Did you mean: 

Adding activiti mail taks

wmoons
Champ in-the-making
Champ in-the-making
Hi,

when I add a mail task to my activiti workflow and I want to deploy it on alfresco I get the following error:

SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.alfresco.error.AlfrescoRuntimeException: 11210000 Workflow deployment failed
   at org.alfresco.repo.workflow.WorkflowDeployer.init(WorkflowDeployer.java:347)
   at org.alfresco.repo.workflow.WorkflowDeployer$1.doWork(WorkflowDeployer.java:465)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:519)
   at org.alfresco.repo.workflow.WorkflowDeployer.onBootstrap(WorkflowDeployer.java:461)
   at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
   at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:209)
   at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:180)
   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:519)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
   at java.util.ArrayList.RangeCheck(ArrayList.java:547)
   at java.util.ArrayList.get(ArrayList.java:322)
   at org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.convert(ActivitiTypeConverter.java:115)
   at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.deployDefinition(ActivitiWorkflowEngine.java:318)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.deployDefinition(WorkflowServiceImpl.java:206)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:146)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy70.deployDefinition(Unknown Source)
   at org.alfresco.repo.workflow.WorkflowDeployer.init(WorkflowDeployer.java:301)
   … 37 more

Can someone explain me from where this is exception is coming?

Thanks
9 REPLIES 9

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Can you post your process definition file? It seems something is missing in it…

wmoons
Champ in-the-making
Champ in-the-making
This is my bpmn file:


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="MyTestProcess" name="MyTestProcess">
    <documentation>Place documentation for the 'MyTestProcess' process here.</documentation>
    <exclusiveGateway id="exclusivegateway1" name="Report for marketing"></exclusiveGateway>
    <userTask id="usertask1" name="Review report" activiti:assignee="wmoons" activiti:formKey="loc:activitireportreview">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>/* next two lines are workarounds ACT-765, ACT-766 */
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>logger.log("setting Marketing value to:" + task.getVariableLocal('loc_isMarketing'));
if(task.getVariableLocal('loc_isMarketing') == 'Yes') {
execution.setVariable('Marketing', 'Yes');
}
else{
execution.setVariable('Marketing', 'No');
}</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow2" name="" sourceRef="exclusivegateway1" targetRef="usertask2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${Marketing == 'Yes'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="usertask2" name="Read marketing report" activiti:candidateGroups="GROUP_Marketing"></userTask>
    <userTask id="usertask3" name="Read report" activiti:candidateGroups="GROUP_Sales"></userTask>
    <sequenceFlow id="flow4" name="" sourceRef="exclusivegateway1" targetRef="usertask3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${Marketing == 'No'}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow6" name="" sourceRef="usertask3" targetRef="mailtask1"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow9" name="" sourceRef="usertask2" targetRef="endevent2"></sequenceFlow>
    <startEvent id="startevent1" name="Start"></startEvent>
    <sequenceFlow id="flow10" name="" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript">
      <script><![CDATA[var Marketing = 'No';]]></script>
    </scriptTask>
    <sequenceFlow id="flow11" name="" sourceRef="scripttask1" targetRef="usertask1"></sequenceFlow>
    <serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to" expression="wimmoons@gmail.com"></activiti:field>
        <activiti:field name="from" expression="helpdesk@loqutus.be"></activiti:field>
        <activiti:field name="subject" expression="Report read"></activiti:field>
        <activiti:field name="text">
          <activiti:expression><![CDATA[The report has been reviewed]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow12" name="" sourceRef="mailtask1" targetRef="endevent2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_MyTestProcess">
    <bpmndi:BPMNPlane bpmnElement="MyTestProcess" id="BPMNPlane_MyTestProcess">
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="600" y="87"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55" width="105" x="420" y="80"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55" width="105" x="770" y="80"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55" width="105" x="568" y="173"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
        <omgdc:Bounds height="35" width="35" x="790" y="260"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="200" y="90"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55" width="105" x="290" y="80"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="mailtask1" id="BPMNShape_mailtask1">
        <omgdc:Bounds height="55" width="105" x="600" y="294"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="640" y="107"></omgdi:waypoint>
        <omgdi:waypoint x="770" y="107"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="620" y="127"></omgdi:waypoint>
        <omgdi:waypoint x="620" y="173"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="620" y="228"></omgdi:waypoint>
        <omgdi:waypoint x="652" y="294"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="525" y="107"></omgdi:waypoint>
        <omgdi:waypoint x="600" y="107"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="822" y="135"></omgdi:waypoint>
        <omgdi:waypoint x="807" y="260"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="235" y="107"></omgdi:waypoint>
        <omgdi:waypoint x="290" y="107"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="395" y="107"></omgdi:waypoint>
        <omgdi:waypoint x="420" y="107"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
        <omgdi:waypoint x="705" y="321"></omgdi:waypoint>
        <omgdi:waypoint x="807" y="321"></omgdi:waypoint>
        <omgdi:waypoint x="807" y="295"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

azivotic
Champ in-the-making
Champ in-the-making
Hi,

I have the same issue, any progress on this?

Regards,
Aleksandar

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Not sure to be honest, but you could use the AlfrescoScriptDelegate rather than using the mail type. You could then use the mail action via Javascript API


// create mail action
var mail = actions.create("mail");
mail.parameters.to = "wimmoons@gmail.com";
mail.parameters.subject = "Report read";
mail.parameters.from = "helpdesk@loqutus.be";
mail.parameters.text = "The report has been reviewed";
// execute action against a document   
mail.execute(bpm_package.children[0]);

azivotic
Champ in-the-making
Champ in-the-making
Thank you on your help, i succeeded to sent email on that way but i was curios what is the problem with activiti mail task inside alfresco workflow?!

Regards,
Aleksandar

tackerman
Champ in-the-making
Champ in-the-making
I just had the same experience myself. I used Activiti Designer in Eclipse to add a Mail Task, deployed the new workflow definition and it failed exactly as you describe.

I believe that probably the version of Activiti deployed with your Alfresco installation does not support a mail task (I don't see a way to tell Activiti Designer which version of Activiti you are developing against).

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
if you are using the enterprise license, the best you can do is raise a ticket with alfresco support (support.alfresco.com). Otherwise you can log it in Jira (issues.alfresco.com)

Sorry for not being more helpful

gjijon
Champ in-the-making
Champ in-the-making
Hello,
I am trying to implement this, but unsuccessfully. In the "Review & approve" workflow (activiti) I want to send emails to assigned user when I start the workflow, and I want to receive an email when the task was approved or rejected… however (implementing the solution in this post) when workflow start, runs or ends, the mail isn't present or send at all… without any error message in the tomcat console.

My email server is running and, in fact, the email in the "AD HOC" workflow works perfectly.

Any help please. Thanks.

gjijon
Champ in-the-making
Champ in-the-making
It works finally. Undeploy and deploy de workflow definition.

Smiley Happy