017-06-10 22:02:31 [localhost-startStop-1] ERROR net.bj.common.web.Toolkit -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 net.bj.common.web.Toolkit.uid(Toolkit.java:103)
at net.bj.app.MvcSetup$1.call(MvcSetup.java:49)
at org.nutz.plugins.slog.service.SlogService.log(SlogService.java:95)
at net.bj.app.MvcSetup.init(MvcSetup.java:54)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4700)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5340)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2017-06-10 22:02:31 DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) INSERT INTO t_syslog_201706(t,tg,src,u_id,ip,msg,ct) VALUES(?,?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|--------|--------|-----------------------------------------------|----|------|------|---------------------|
| method | system | org.nutz.plugins.slog.service.SlogService#log | -1 | NULL | 系统启动 | 2017-06-10 22:02:30 |
Toolkit.uid
public static Long uid() {
Long uid = -1L;
Object user;
try {
user = SecurityUtils.getSubject().getPrincipal();
} catch (Throwable e) {
return -1L;
}
if (user != null) {
if (user instanceof User) {
uid = ((User) user).getId();
} else if (user instanceof Number) {
uid = ((Number) user).longValue();
}
}
return uid;
}