cancel
Showing results for 
Search instead for 
Did you mean: 

EMAIL TASK ERROR

shaparak-smmira
Champ in-the-making
Champ in-the-making
Hi
I want to use email task in my activiti app ,but when run app and this task in run , This throws this exception :


Caused by: org.activiti.engine.ActivitiException: couldn't instantiate class org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
   at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:132)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.instantiateDelegate(ClassDelegate.java:163)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:136)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:113)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:45)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:66)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:88)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:367)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:105)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:54)
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.signal(UserTaskActivityBehavior.java:96)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:350)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:160)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:39)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
   at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:61)
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:168)
   at com.anisa.activiti.web.jsf.ComplaintComponentImpl.completeTask(ComplaintComponentImpl.java:136)
   at com.anisa.activiti.web.jsf.ComplaintComponentImpl.completeTask(ComplaintComponentImpl.java:147)
   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:319)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy38.completeTask(Unknown Source)
   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 javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
   at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
   at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
   at com.sun.el.parser.AstValue.invoke(AstValue.java:228)
   at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
   at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
   … 69 more
Caused by: org.activiti.engine.ActivitiClassLoadingException: Could not load class: org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
   at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:82)
   at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:129)
   … 151 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/mail/EmailException
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:247)
   at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:63)
   … 152 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.mail.EmailException
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
   … 155 more



In Application.xml I set mail sever for activiti like this :

<property name="mailServerHost" value="smtp.gmail.com" />
      <property name="mailServerPort" value="587" />
      <property name="mailServerDefaultFrom" value="xxx" />
      <property name="mailServerUsername" value="xxx" />
      <property name="mailServerPassword" value="xxx" />
      <property name="mailServerUseSSL" value="true" />


And my mail task is :

<serviceTask completionQuantity="1"  activiti:class="org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior" id="mailtask1" implementation="webService" isForCompensation="false" name="Email to applicant on status &quot;OnHold&quot;" startQuantity="1" >
      <extensionElements>
        <activiti:field name="to" value="user@gmail.com"></activiti:field>
        <activiti:field name="from" value="user2@gmail.com"></activiti:field>
        <activiti:field name="subject" value="Test"></activiti:field>
        <activiti:field name="charset" value="utf-8"></activiti:field>
        <activiti:field name="html">
          <activiti:expression><![CDATA[<html>
            <body>
              hi,<br/><br/>
                
             </b>.<br/><br/>
                 
              Kind regards,<br/>
                 
              TheCompany.
            </body>
          </html>]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>


In app I don’t use Alfresco or other app that use activiti and my activiti version in 5.15

Plz help me!
9 REPLIES 9

shaparak-smmira
Champ in-the-making
Champ in-the-making
my activiti version is 5.14

trademak
Star Contributor
Star Contributor
If you would like to use the mail task then use it as described in the user guide:

http://activiti.org/userguide/index.html#bpmnEmailTask

Best regards,

thanks for reply

i read guide and do it  step by step

when i set type of serviceTask  to "mail" in bpmn diagram and deploy it to my app, occur this error.
<code>Caused by: org.activiti.engine.ActivitiClassLoadingException: Could not load class: org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:82)
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:129)
… 151 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/mail/EmailException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:63)
… 152 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.mail.EmailException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
… 155 more</code>

but when set services task  like this post
<code>
class="org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior" id="mailtask1" implementation="webService"</code>

it work and deploy bpmn to my app.
but when Process is work when email task occur ,throws this exception  and not work

in Activiti-engine jar file I have this class "org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior", but error said not load

plz help me

martin_grofcik
Confirmed Champ
Confirmed Champ
Could not be problem:

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/mail/EmailException

Martin

shaparak-smmira
Champ in-the-making
Champ in-the-making
hi , thanks for reply

I check it ,my app have this jar files for mail:

commons-logging-1.1.1.jar
mail.jar
axis-1.4.jar
jaxrpc-api-1.1.jar



but this error occured!

ollib
Champ in-the-making
Champ in-the-making
perhaps you also need commons email http://commons.apache.org/proper/commons-email/

shaparak-smmira
Champ in-the-making
Champ in-the-making
hi ,

thanks for reply ollib , this problem solved, myapp needs this jar file

shaparak-smmira
Champ in-the-making
Champ in-the-making
problem is solved but when I use expression in  html field ,this expression not replace whith value

<code>
<activiti:string>
<![CDATA[<html>
<body >
    hi <br/>
    As of ${tracking_no}, your order has been <b>processed and shipped</b>.<br/><br/>                 
    Kind regards,<br/>

</body>
</html>]]></activiti:string>
</code>

and when email resived

hi

As of ${tracking_no}, your order has been processed and shipped.

Kind regards,
TheCompany.

in activiti database in table "act_ru_variable" ,"tracking_no" has value .

plz help me!

jbarrez
Star Contributor
Star Contributor
Injection with a string are NEVER resolved. That's why it is a string.

You need an expression. From the user guide:

<code>
<activiti:field name="html">
      <activiti:expression>
        <![CDATA[
          <html>
            <body>
              Hello ${male ? 'Mr.' : 'Mrs.' } ${recipientName},<br/><br/>
                
              As of ${now}, your order has been <b>processed and shipped</b>.<br/><br/>
                 
              Kind regards,<br/>
                 
              TheCompany.
            </body>
          </html>
        ]]>
      </activiti:expression>
    </activiti:field>     
</code>
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.