Is your temp dir consistent between restarts? On Thu, Sep 22, 2016 at 4:31 AM, martinafterdark <[email protected]> wrote:
> I am using dropwizard 1.0, jersey 2.23.1, jetty 9.3.9.v20160517, shiro > 1.3.2, > silb/shiro-jersey and ehcache 2.5.3. > > every time i restart the server, i need to login again. > > I have check the file shiro-activeSessionCache.data (deserialized it) and > compared it with the http header. > > The session Id is appears to be correct, and is in the cache but i still > get > the exception: > > DEBUG [2016-09-20 11:21:57,803] org.apache.shiro.web.servlet.SimpleCookie: > Found 'JSESSIONID_MY_SESSION' cookie value > [f1f5e995-d509-4e25-adae-0355c87858c6] > INFO [2016-09-20 11:21:57,803] > org.apache.shiro.cache.ehcache.EhCacheManager: Using existing EHCache > named > [shiro-activeSessionCache] > DEBUG [2016-09-20 11:21:57,805] 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 [f1f5e995-d509-4e25-adae-0355c87858c6] > ! at > org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession( > AbstractSessionDAO.java:170) > > shiro.ini > > cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager > cacheManager.cacheManagerConfigFile = classpath:shiro-ehcache.xml > securityManager.cacheManager = $cacheManager > > # Realms > jdbcRealm = com.myTest.JdbcAuthorizingRealm > securityManager.realms = $jdbcRealm > > # Configure Session Manager > sessionManager = org.apache.shiro.web.session. > mgt.DefaultWebSessionManager > sessionManager.sessionValidationInterval = 5000000 > sessionManager.globalSessionTimeout = 5000000 > > # Session Cookie > sessionIdCookie = org.apache.shiro.web.servlet.SimpleCookie > sessionIdCookie.name = JSESSIONID_MY_SESSION > # Max age one year in seconds > sessionIdCookie.maxAge = 31536000 > sessionManager.sessionIdCookie = $sessionIdCookie > > # Set Session Manager > securityManager.sessionManager = $sessionManager > sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO > securityManager.sessionManager.sessionDAO = $sessionDAO > > > shiro-ehcache.xml: > > <ehcache updateCheck="false"> > > <diskStore path="java.io.tmpdir/shiro-ehcache"/> > > <defaultCache > maxElementsInMemory="10000" > eternal="false" > timeToIdleSeconds="120" > timeToLiveSeconds="120" > overflowToDisk="false" > diskPersistent="false" > diskExpiryThreadIntervalSeconds="120" > /> > > <cache name="shiro-activeSessionCache" > maxElementsInMemory="10000" > overflowToDisk="true" > eternal="true" > timeToLiveSeconds="0" > timeToIdleSeconds="0" > diskPersistent="true" > diskExpiryThreadIntervalSeconds="600" > /> > > </ehcache> > > > The shiro-activeSessionCache.data: > > [ key = f1f5e995-d509-4e25-adae-0355c87858c6, > value=org.apache.shiro.session.mgt.SimpleSession,id= > f1f5e995-d509-4e25-adae-0355c87858c6, > version=1, hitCount=2, CreationTime = 1474369908000, LastAccessTime = > 1474369908000 ] > > The Session id from the cookie: > f1f5e995-d509-4e25-adae-0355c87858c6 > > are there any example projects that shows how to use caching correctly? > > > > > -- > View this message in context: http://shiro-user.582556.n2. > nabble.com/Problem-with-Session-Caching-and-Server-Restart-tp7581280.html > Sent from the Shiro User mailing list archive at Nabble.com. >
