You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JBPM 7.56.0 基于DB用户的任务通知发送失败问题咨询

JBPM 7.56.0 切换DB用户源后邮件通知失败问题排查

错误信息

23:49:35,378 ERROR [org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener] (EJB default - 1) Unable to send email notification due to null

此前基于userinfo.property实现的任务通知可正常运行,切换为使用DB用户源发送通知时触发上述空指针异常,报错位置为org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener.onNotification(EmailNotificationListener.java:122),使用版本为JBPM 7.56.0。


现有配置梳理

1. standalone.xml 配置

<property name="org.kie.server.persistence.ds" value="java:jboss/datasources/jBPMDS"/>
<property name="org.jbpm.ht.userinfo" value="db"/>
<property name="jbpm.usergroup.callback.properties" value="WEB-INF/jbpm.usergroup.callback.properties"/>
<security-domain name="other" cache-type="default">
    <authentication>
        <login-module code="Remoting" flag="optional">
            <module-option name="password-stacking" value="useFirstPass"/>
        </login-module>
        <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
            <module-option name="dsJndiName" value="java:jboss/datasources/jBPMDS"/>
            <module-option name="principalsQuery" value="select passwd from users where username=?"/>
            <module-option name="rolesQuery" value="select userroles, 'Roles' from UserRoles where username=?"/>
        </login-module>
        <login-module code="org.kie.security.jaas.KieLoginModule" flag="optional" module="deployment.business-central.war"/>
        <login-module name="org.kie.security.jaas.KieLoginModule-2" code="org.kie.security.jaas.KieLoginModule" flag="optional" module="deployment.jbpm-casemgmt.war"/>
    </authentication>
</security-domain>

<subsystem xmlns="urn:jboss:domain:mail:3.0">
    <mail-session name="notification" debug="true" jndi-name="java:/notificationMailSession" from="matara68@gmail.com">
        <smtp-server outbound-socket-binding-ref="mail-notification-smtp" ssl="true" username="matara68@gmail.com" password="xxxxx"/>
    </mail-session>
</subsystem>

<outbound-socket-binding name="mail-notification-smtp">
    <remote-destination host="smtp.gmail.com" port="465"/>
</outbound-socket-binding>

2. jbpm.user.info.properties 配置

db.ds.jndi.name=java:jboss/datasources/jBPMDS
db.name.query=select username from jbpm56.users where username = ?
db.email.query=select user_email from jbpm56.users where username = ?
db.lang.query=select user_lang from jbpm56.users where username = ?
db.group.mem.query=select username from jbpm56.UserRoles where userroles = ?

3. jbpm.usergroup.callback.properties 配置

db.ds.jndi.name=java:jboss/datasources/jBPMDS
db.name.query=select username from jbpm56.users where username = ?
db.email.query=select user_email from jbpm56.users where username = ?
db.lang.query=select user_lang from jbpm56.users where username = ?
db.group.mem.query=select username from jbpm56.UserRoles where userroles = ?

4. 栈追踪关键日志

23:49:35,316 DEBUG [org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener] (EJB default - 1) User info implementation org.jbpm.services.task.identity.DBUserInfoImpl@5185fc7a and mail session javax.mail.Session@735b8ef1
23:49:35,378 ERROR [org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener] (EJB default - 1) Unable to send email notification due to null
23:49:35,378 DEBUG [org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener] (EJB default - 1) Stacktrace:: java.lang.NullPointerException
        at deployment.kie-server.war//org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener.onNotification(EmailNotificationListener.java:122)

问题原因

JBPM 7.56.0版本中EmailNotificationListener第122行逻辑为调用用户邮箱地址发送邮件,空指针的直接原因是系统从DB查询到的用户邮箱为null,结合配置确认核心问题如下:

  • 配置缺失:standalone.xml中仅指定了用户信息源为DB,未配置jbpm.user.info.properties的加载路径,系统未加载自定义的DB查询语句,使用默认查询规则匹配不到用户表
  • 表配置不一致:登录模块的用户查询表为不带schema的users/UserRoles,但用户信息查询配置的表为jbpm56.users/jbpm56.UserRoles,schema不匹配会导致查询无结果
  • 用户数据异常:待通知用户的user_email字段为空

解决方案

  1. 在standalone.xml的系统属性中添加jbpm.user.info.properties加载配置:
<property name="jbpm.user.info.properties" value="WEB-INF/jbpm.user.info.properties"/>
  1. 统一用户表的查询规则,可直接在数据库执行测试SQL验证查询有效性:
select user_email from jbpm56.users where username = '测试通知用户名'

如果无返回结果,调整properties配置中的表名/schema,与登录模块的查询规则保持一致即可
3. 核对所有待接收通知的用户,确保user_email字段存储了有效的邮箱地址,不可为null
4. 重启JBPM服务验证功能


内容的提问来源于stack exchange,提问作者Matara68

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 22:18:02