Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XxlJob 的定时任务使用 @TenantJob 注解如返回方法为 void 会导致空指针异常 #693

Closed
shanaiardor opened this issue Nov 6, 2024 · 2 comments

Comments

@shanaiardor
Copy link
Contributor

基本信息

  • ruoyi-vue-pro 版本:2.3.0
  • 操作系统:linux
  • 数据库:pgsql

你猜测可能的原因

tenantJob 注解处理方法中使用 ConcurrentHashMap 收集执行返回值,如方法返回值为 void 则会使 ConcurrentHashMap 插入 null 导致报错

复现步骤

  1. 任务返回值为 void 使用 @TenantJob 注解
  2. 执行定时任务

报错信息

2024-11-06 17:11:28 [com.xxl.job.core.thread.JobThread#run]-[133]-[xxl-job, JobThread-52-xxx]
----------- xxl-job job execute start -----------
----------- Param:
2024-11-06 17:11:29 [com.xxx.framework.tenant.core.job.TenantJobAspect#lambda$around$0]-[58]-[xxl-job, JobThread-52-xxx] [多租户(xxx) 执行任务(void com.xxx.module.system.job.demo.DemoJob.execute()),发生异常:java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at com.xxx.framework.tenant.core.job.TenantJobAspect.lambda$around$0(TenantJobAspect.java:53)
at com.xxx.framework.tenant.core.util.TenantUtils.execute(TenantUtils.java:33)
at com.xxx.framework.tenant.core.job.TenantJobAspect.lambda$around$1(TenantJobAspect.java:50)

@shanaiardor
Copy link
Contributor Author

#694

@YunaiV
Copy link
Owner

YunaiV commented Nov 9, 2024

感谢,赞!

@YunaiV YunaiV closed this as completed Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants