NutzCN Logo
问答 定时任务里调用SecurityUtils.getSubject()方法报错
发布于 2544天前 作者 qq_1f6f8a40 5271 次浏览 复制 上一个帖子 下一个帖子
标签:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.
	at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)
	at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:627)
	at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)
	at com.znzz.app.web.commons.quartz.job.InsMessageInfoJob.execute(InsMessageInfoJob.java:41)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
[ERROR] 2018-01-04 15:25:37,261 org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2425) - Job (f472ee58dbf14f3da5d5d7e3b6b3b9a2.f472ee58dbf14f3da5d5d7e3b6b3b9a2 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.
	at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)
	at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:627)
	at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)
	at com.znzz.app.web.commons.quartz.job.InsMessageInfoJob.execute(InsMessageInfoJob.java:41)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	... 1 more
1 回复

job里面不能获取当前用户的, 因为不存在当前用户

添加回复
请先登陆
回到顶部