NutzCN Logo
问答 打开页面就报错session
发布于 2859天前 作者 Hamming 3082 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

打开页面就报错

2017-02-23 14:08:23,330 [http-nio-8080-exec-9] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [b5946ddb-59f1-4e96-bbc8-c3f6699f24ef]
2017-02-23 14:08:23,330 [http-nio-8080-exec-9] DEBUG org.apache.shiro.mgt.DefaultSecurityManager - Resolved SubjectContext context session is invalid.  Ignoring and creating an anonymous (session-less) Subject instance.
org.apache.shiro.session.UnknownSessionException: There is no session with id [b5946ddb-59f1-4e96-bbc8-c3f6699f24ef]
	at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261)
	at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236)
	at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222)
	at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118)
	at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108)
	at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getSession(AbstractNativeSessionManager.java:100)
	at org.apache.shiro.mgt.SessionsSecurityManager.getSession(SessionsSecurityManager.java:125)
	at org.apache.shiro.mgt.DefaultSecurityManager.resolveContextSession(DefaultSecurityManager.java:456)
	at org.apache.shiro.mgt.DefaultSecurityManager.resolveSession(DefaultSecurityManager.java:442)
	at org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:338)
	at org.apache.shiro.subject.Subject$Builder.buildSubject(Subject.java:846)
	at org.apache.shiro.web.subject.WebSubject$Builder.buildWebSubject(WebSubject.java:148)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.createSubject(AbstractShiroFilter.java:292)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:359)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
2017-02-23 14:08:23,331 [http-nio-8080-exec-9] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/home/support : HomeModule.support(HomeModule.java:47)
2017-02-23 14:08:23,331 [http-nio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'permission'<class com.ikmcy.common.shiro.view.Permission>
2017-02-23 14:08:23,331 [http-nio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dateUtil'<class com.ikmcy.common.util.DateUtil>
2017-02-23 14:08:23,332 [http-nio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'stringUtil'<class com.ikmcy.common.util.StringUtil>
2017-02-23 14:08:23,332 [http-nio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'homeModule'<class com.ikmcy.modules.controllers.open.HomeModule>
2017-02-23 14:08:23,332 [http-nio-8080-exec-9] INFO  com.ikmcy.modules.controllers.open.HomeModule - HomeModule#service
2017-02-23 14:08:23,332 [http-nio-8080-exec-9] DEBUG com.ikmcy.common.processor.LogTimeProcessor - [GET ]URI=/home/support 1ms

3 回复

如何让session时间配置很短呢 然后 不集成redis

[main]
# cacheManager
### 第一层是ehcache,本地缓存,速度快
cacheManager_ehcache = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager_ehcache.cacheManagerConfigFile=classpath:ehcache.xml
### 第二层是redis,独立进程,持久化,集群化
cacheManager_redis = org.nutz.integration.shiro.cache.RedisCacheManager
### 使用LCacheManager组合两层缓存.
cacheManager = org.nutz.integration.shiro.cache.LCacheManager
cacheManager.level1 = $cacheManager_ehcache
cacheManager.level2 = $cacheManager_redis


# Session
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager

# Session Cache
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionDAO.cacheManager=$cacheManager
sessionDAO.activeSessionsCacheName=shiro-activeSessionCache
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager

# Cookie
sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
#sessionIdCookie.domain=admin
#sessionIdCookie.path=
sessionIdCookie.maxAge=3600000
sessionIdCookie.httpOnly=true
sessionManager.sessionIdCookie=$sessionIdCookie
sessionManager.sessionIdCookieEnabled=true
sessionManager.globalSessionTimeout=3600000

#bak...
#sessionManager=org.apache.shiro.web.session.mgt.DefaultWebSessionManager
#sessionListener1 = cn.wizzer.common.shiro.listener.MySessionListener
#sessionManager.sessionListeners = $sessionListener1
#sessionManager.globalSessionTimeout=50000
#securityManager.sessionManager=$sessionManager

rememberMeCookie = org.apache.shiro.web.servlet.SimpleCookie
rememberMeCookie.name=remember
rememberMeCookie.maxAge = 604800
rememberMeCookie.httpOnly = true
rememberMeManager = org.apache.shiro.web.mgt.CookieRememberMeManager
rememberMeManager.cookie = $rememberMeCookie

sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
sha256Matcher.storedCredentialsHexEncoded = false
sha256Matcher.hashIterations = 1024
sha256Matcher.hashSalted = true

shiroDbRealm = com.ikmcy.common.shiro.realm.NutDaoRealm
shiroDbRealm.credentialsMatcher = $sha256Matcher

securityManager.realms = $shiroDbRealm
authcStrategy = com.ikmcy.common.shiro.authc.pam.AnySuccessfulStrategy
securityManager.authenticator.authenticationStrategy = $authcStrategy
### 设置全局缓存实现
securityManager.cacheManager = $cacheManager

securityManager.rememberMeManager = $rememberMeManager

authc = com.ikmcy.common.shiro.filter.SimpleAuthenticationFilter
authc.loginUrl  = /platform/login
logout.redirectUrl= /platform/login

[urls]
/platform/doLogin    = anon
/home/**           = anon
/assets/**          = anon
/**                 = anon
/platform/**         = authc

最近改过啥

第一次访问抛debug异常正常吧,log4j配成info就不会显示了

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