You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Bernhard Hirschmann <bh...@web-systeme.de> on 2013/03/15 15:10:55 UTC

Configuration issue using distributed cache

Hello!

I'm somehow stuck in configuring Shiro for our JEE application, using
session clustering and our own implementation of
org.apache.shiro.cache.Cache. 
(our cache implementation makes use of WebSphere's
com.ibm.websphere.cache.DistributedMap class to achieve a distributed
cache.)

Here is the main section from our shiro.ini:

[main]
jdbcRealm = com.dummy.common.security.OurJdbcRealm

activeSessionsCache = com.dummy.common.security.OurShiroCache
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO 
sessionDAO.activeSessionsCache = $activeSessionsCache

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager 
sessionManager.sessionDAO = $sessionDAO 
securityManager.sessionManager = $sessionManager 


Unfortunately I'm getting the following error while calling the application:

org.apache.shiro.session.UnknownSessionException: There is no session with
id [1643fee1-cbb2-4806-9d4d-390405d43a7f]

This error happens in the init state of our application, where some
attibutes are tried to set to the current session. I can see in the debugger
that the session is stored correctly in the cache and also some attributes.
Then later, when trying again to store some attributes the session is not
available anymore in the cache. Currently I can't figure out why. I think I
have an obvious error in my shiro.ini and I hope you guys can help me out
this mess...




--
View this message in context: http://shiro-user.582556.n2.nabble.com/Configuration-issue-using-distributed-cache-tp7578410.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Configuration issue using distributed cache

Posted by Bernhard Hirschmann <bh...@web-systeme.de>.
Hi Les,

Thank you for your answer! I finally found out, that the session was
invalidated in the init phase of the application by the logic of the "legacy
code", which happend right after Shiro initialized itself. Correcting this
solved the problem.




--
View this message in context: http://shiro-user.582556.n2.nabble.com/Configuration-issue-using-distributed-cache-tp7578410p7578444.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Configuration issue using distributed cache

Posted by Les Hazlewood <lh...@apache.org>.
Hi Bernhard,

It's usually ok to see UnknownSessionExceptions - at least the native
session manager will usually catch them and just initiate a new
session.  I can't say this is the case for your particular use case,
but typically these are thrown if Shiro can't find a Session in the
SessionDAO for a given session ID.

Maybe in your case it is a lifecycle issue?  That is, perhaps the
cache isn't initialized/ready at the time the call is made?

(side note: we recently found a bug where init() isn't being called on
custom objects in the .ini configuration, and we're working to get a
1.2.2 patch out quickly.  The simplest way to fix this in the meantime
is to lazy-load things as they are needed instead of doing it in a
custom init() method.  I don't know if this is affecting you, but I
thought I'd put it out there just in case it helps debug).

Regards,

Les

On Fri, Mar 15, 2013 at 7:10 AM, Bernhard Hirschmann
<bh...@web-systeme.de> wrote:
> Hello!
>
> I'm somehow stuck in configuring Shiro for our JEE application, using
> session clustering and our own implementation of
> org.apache.shiro.cache.Cache.
> (our cache implementation makes use of WebSphere's
> com.ibm.websphere.cache.DistributedMap class to achieve a distributed
> cache.)
>
> Here is the main section from our shiro.ini:
>
> [main]
> jdbcRealm = com.dummy.common.security.OurJdbcRealm
>
> activeSessionsCache = com.dummy.common.security.OurShiroCache
> sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
> sessionDAO.activeSessionsCache = $activeSessionsCache
>
> sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
> sessionManager.sessionDAO = $sessionDAO
> securityManager.sessionManager = $sessionManager
>
>
> Unfortunately I'm getting the following error while calling the application:
>
> org.apache.shiro.session.UnknownSessionException: There is no session with
> id [1643fee1-cbb2-4806-9d4d-390405d43a7f]
>
> This error happens in the init state of our application, where some
> attibutes are tried to set to the current session. I can see in the debugger
> that the session is stored correctly in the cache and also some attributes.
> Then later, when trying again to store some attributes the session is not
> available anymore in the cache. Currently I can't figure out why. I think I
> have an obvious error in my shiro.ini and I hope you guys can help me out
> this mess...
>
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Configuration-issue-using-distributed-cache-tp7578410.html
> Sent from the Shiro User mailing list archive at Nabble.com.