Flowable中的邮件服务任务抛出api.FlowableException - java.net.ConnectException:连接被拒绝

时间:2018-04-02 16:35:26

标签: spring-boot activiti flowable

在我们的项目中,我们的任务是在完成某项任务后向某些用户发送通知。

以下是用BPMN2.0 xml编写的代码 -

<serviceTask id="notifyPartner" name="Notify Partner" flowable:type="mail">
      <documentation>Notify Partner about the assignment.</documentation>
      <extensionElements>
        <flowable:field name="to">
          <flowable:string><![CDATA[testemail@some.com]]></flowable:string>
        </flowable:field>
        <flowable:field name="from">
          <flowable:string><![CDATA[testemail@some.com]]></flowable:string>
        </flowable:field>
        <flowable:field name="subject">
          <flowable:string><![CDATA[Notify Partner]]></flowable:string>
        </flowable:field>
        <flowable:field name="text">
          <flowable:string><![CDATA[Notify Partner about the assignment.]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>

将application.properties作为 -

spring.flowable.mailServerHost=smtp.gmail.com
spring.flowable.mailServerPort=587
spring.flowable.mailServerUserName=testemail@some.com
spring.flowable.mailServerPassword=****
spring.flowable.mailServerUseTls=true

但这一切都没有成功。它给出了以下错误 -

java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)

我甚至尝试在flowable.cfg.xml中设置所有属性

 <property name="mailServerHost" value="smtp.gmail.com" />
    <property name="mailServerPort" value="587" />
    <property name="mailServerUseTls" value="true" />
    <property name="mailServerUsername" value="testemail@some.com" />
    <property name="mailServerPassword" value="****" />

是否缺少其他配置? 使用的可流动版本是6.2.1。

1 个答案:

答案 0 :(得分:0)

如果您将Spring Boot启动器用于Flowable 6.2.1,则需要从属性中删除前导spring.

您的属性应如下所示:

flowable.mailServerHost=smtp.gmail.com
flowable.mailServerPort=587
flowable.mailServerUserName=testemail@some.com
flowable.mailServerPassword=****
flowable.mailServerUseTls=true

使用Spring Boot时,flowable.cfg.xml并未用于配置引擎。

注意::当迁移到Flowable 6.3.x时,属性略有变化,它们的外观应如下所示:

flowable.mail.server.host=smtp.gmail.com
flowable.mail.server.port=587
flowable.mail.server.username=testemail@some.com
flowable.mail.server.password=****
flowable.mail.server.use-tls=true