You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Stefan Lorenz <St...@persis.de> on 2013/07/26 12:46:20 UTC

Share Session between multiple war files

Hi,

I've an ear project with multiple war files,
the problem that I get is, that the session changes if I change from one war-Context to another.

I've configured the ehCache and sessionDAO etc. correctly, I think...

On glassfish startup every war context loads Shiro correctly.

WebModule[null] ServletContext.log():Initializing Shiro environment
INFO org.apache.shiro.web.env.EnvironmentLoader - Starting Shiro environment initialization.
INFO org.apache.shiro.cache.ehcache.EhCacheManager - Using existing EHCache named [myAuthorizationCache]
INFO org.apache.shiro.config.IniSecurityManagerFactory - Realms have been explicitly set on the SecurityManager instance - auto-setting of realms will not occur.
INFO org.apache.shiro.web.env.EnvironmentLoader - Shiro environment initialized in 3 ms.


Is it really necessary to use Terracotta or Coherence for that?

Regards,
Stefan

Re: Share Session between multiple war files

Posted by Kalle Korhonen <ka...@gmail.com>.
On Fri, Jul 26, 2013 at 3:46 AM, Stefan Lorenz <St...@persis.de>wrote:

>  I’ve an ear project with multiple war files,****
>
> the problem that I get is, that the session changes if I change from one
> war-Context to another.****
>
> ** **
>
> I’ve configured the ehCache and sessionDAO etc. correctly, I think…****
>
> ** **
>
> On glassfish startup every war context loads Shiro correctly.****
>
> ** **
>
> WebModule[null] ServletContext.log():Initializing Shiro environment****
>
> INFO org.apache.shiro.web.env.EnvironmentLoader - Starting Shiro
> environment initialization.****
>
> INFO org.apache.shiro.cache.ehcache.EhCacheManager - Using existing
> EHCache named [myAuthorizationCache]****
>
> INFO org.apache.shiro.config.IniSecurityManagerFactory - Realms have been
> explicitly set on the SecurityManager instance - auto-setting of realms
> will not occur.****
>
> INFO org.apache.shiro.web.env.EnvironmentLoader - Shiro environment
> initialized in 3 ms.****
>
>  Is it really necessary to use Terracotta or Coherence for that?****
>
>
If "it" is session sharing, then answer is no - you can also use a
container specific implementation, such as session replication in Tomcat (
http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html).

Kalle

Re: Share Session between multiple war files

Posted by Les Hazlewood <lh...@apache.org>.
If you're using Shiro's native session management, then yes, you will need
to use a clustered cache to support session sharing.  Tomcat's
implementation, while it does the same thing, is Tomcat-specific.  If you
do it in Shiro, then it will work no matter what servlet container you
choose (Tomcat, Jetty, etc..)

--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282


On Fri, Jul 26, 2013 at 3:46 AM, Stefan Lorenz <St...@persis.de>wrote:

>  Hi,****
>
> ** **
>
> I’ve an ear project with multiple war files,****
>
> the problem that I get is, that the session changes if I change from one
> war-Context to another.****
>
> ** **
>
> I’ve configured the ehCache and sessionDAO etc. correctly, I think…****
>
> ** **
>
> On glassfish startup every war context loads Shiro correctly.****
>
> ** **
>
> WebModule[null] ServletContext.log():Initializing Shiro environment****
>
> INFO org.apache.shiro.web.env.EnvironmentLoader - Starting Shiro
> environment initialization.****
>
> INFO org.apache.shiro.cache.ehcache.EhCacheManager - Using existing
> EHCache named [myAuthorizationCache]****
>
> INFO org.apache.shiro.config.IniSecurityManagerFactory - Realms have been
> explicitly set on the SecurityManager instance - auto-setting of realms
> will not occur.****
>
> INFO org.apache.shiro.web.env.EnvironmentLoader - Shiro environment
> initialized in 3 ms.****
>
> ** **
>
> ** **
>
> Is it really necessary to use Terracotta or Coherence for that?****
>
> ** **
>
> Regards,****
>
> Stefan****
>