NutzCN Logo
问答 Linux下,shoir报错
发布于 2513天前 作者 qq_2ac473ac 1923 次浏览 复制 上一个帖子 下一个帖子
标签:

在Windows和eclipse里面都是正常的!

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.qcjy.kotya.util.Toolkit.getloginid(Toolkit.java:108)
	at com.qcjy.kotya.service.userService.add(userService.java:39)
	at com.qcjy.kotya.MainSetup.init(MainSetup.java:31)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	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:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	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:4950)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1015)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:991)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
7 回复

getloginid里面try catch 一下就行啦

public static Integer getloginid() {
		int i=0;
		try {
			Subject currentUser = SecurityUtils.getSubject(); 
			Session session = currentUser.getSession();
			i= (Integer) session.getAttribute("me");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return i;
		
	}

要修改的话,应该怎么改啊,大神

把e.printStackTrace();注释掉就不会打印啦

这个报错不影响程序么?

好的,谢谢。再问大神一个问题,怎么关闭那么多的日志啊?

log4j.properties

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