cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Task Fails to Execute using Activiti Rest Service

softcoder
Champ in-the-making
Champ in-the-making
Hi,
I have a workflow that contains a mail task. Prior to adding the mail task, user tasks and service tasks have been executing well. Upon adding mail tasks, i get the exception added below.
My best guess is my mail conffiguration is wrong.
I have tried:
1- Creating a activiti-cfg.jar which contains activiti.cfg.xml with my appropriate mail config and putting it in my tomcat/lib and build path of the activiti-rest app. Doesn't work.
2- Creating mail.properties file in my class path with appropriate mail config. Doesn't work.
3- Creating activiti-standalone-context.xml contaning the mail config in rest and explorer app. Doesn't work.
4- Putting activiti.cfg.xml in the build path of my explorer and rest app. Doesn't work.

I am using Activiti v5.16.4.
Any Suggestions?

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/activiti-rest] threw exception [Request processing failed; nested exception is org.activiti.engine.ActivitiException: Could not send e-mail in execution 102529] with root cause
java.net.ConnectException: Connection refused: connect
   at java.net.DualStackPlainSocketImpl.connect0(Native Method)
   at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
   at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
   at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
   at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
   at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
   at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
   at javax.mail.Service.connect(Service.java:288)
   at javax.mail.Service.connect(Service.java:169)
   at javax.mail.Service.connect(Service.java:118)
   at javax.mail.Transport.send0(Transport.java:188)
   at javax.mail.Transport.send(Transport.java:118)
   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
   at org.apache.commons.mail.Email.send(Email.java:1267)
   at org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior.execute(MailActivityBehavior.java:83)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
The error is pretty clear … It cant reach the mail server. Either your config to the server is wrong, or activiti simply cant access it from the server it runs on.

softcoder
Champ in-the-making
Champ in-the-making
Activiti v5.16.4 couldn't read the config file.
From what i can see here http://forums.activiti.org/content/help-activiti5164-where-config-file-activiti-standalone-contextxm...
The problem is from your end.
"We did indeed change from XML -> Java Config in the latest release.
But we do need to write up the docs for this how we can configure this."

Works on v5.16.3

trademak
Star Contributor
Star Contributor
Yes, you can set the mail server configuration by writing you own Java config for the Explorer and REST app in 5.16.4.
For the upcoming 5.17 release we'll make sure property or XML config is also possible.

Best regards,

imsrk
Champ in-the-making
Champ in-the-making
Hi,

Mail task from Rest API still doesn't work

Also when I looked into ActivitiEngineConfiguration.java for activiti-webapp-rest2 I don't find any mail specific settings as it use to be there for activiti-webapp-explorer2

https://github.com/Activiti/Activiti/blob/97d221fa0a779fbf8dbf7ee056613223cd693155/modules/activiti-...

Kindly advise as this sounds like bug or possibly limitation and I'm really stuck with my process evaluation. I am using activiti version 5.20.0

Also I have tried earlier copying the mail properties in engine.properties for the activiti-rest similar to activiti-explorer but after going through above source I realize it's not at all reading or considering mail properties.

Kindly suggest workaround in the interim as this I'm stuck.

Thanks.