Thanks for the hint, Jared. Each WAR does contain its own copies of the shiro jars so I will investigate the classloader idea to start and report back with whatever I discover.
Thanks again, -Ryan On Apr 9, 2012 12:18 PM, "Jared Bunting" <jared.bunt...@peachjean.com> wrote: > So, the key here seems to be this message: argument type mismatch - had > objects of type "org.apache.shiro.cache.ehcache.EhCacheManager" but > expected signature "org.apache.shiro.cache.CacheManager" > > This sort of error is typically due to classloader/classpath issues. > Do you have libraries that are shared between wars? Do you have > libraries that aren't? My guess is that there's some sort of conflict > between multiple copies of shiro-core and shiro-ehcache. For the ear > approach, I think the recommendation would be to either have all of the > shiro libraries shared between all wars, or all of the shiro libraries > specifically in each individual war file. > > -Jared > > On Mon 09 Apr 2012 08:24:55 AM CDT, Ryan Connolly wrote: > > Hello, > > > > I have been attempting to implement SSO for multiple web apps being > > deployed in an EAR file. > > The example I am following uses ehCache and is documented in the > > following post: > > > > > http://mail-archives.apache.org/mod_mbox/incubator-shiro-user/201009.mbox/%3CAANLkTimCoo45=dp0s56fb7ipv75etwr+ds9a2o172...@mail.gmail.com%3E > > > > While this approach works well when deploying individual WAR files to > > JBoss AS 7.x, I cannot seem to get the configuration right when > > deploying multiple WAR files contained in a single EAR file. I'm > > hoping someone out there may know what is going on. What appears to > > be happening is that the first WAR to be deploy deploys correctly but > > any WAR (contained in the EAR) that gets deployed after that fails > > which leads me to believe that I should have a single shiro.ini file > > for the EAR deployment? > > > > > > > > Below is the shiro.ini configuration contained in each of the WAR files: > > > > [main] > > authc = com.example.security.ShiroFormAuthenticationFilter > > authc.loginUrl = /login.html > > > > activeDirectoryRealm = com.example.security.ShiroActiveDirectoryRealm > > > > # Cache for single sign on (SSO) > > ssoCacheManager = org.apache.shiro.cache.ehcache.EhCacheManager > > ssoCacheManager.cacheManagerConfigFile = classpath:ehcache.xml > > securityManager.cacheManager = $ssoCacheManager > > > > # native for single sign on > > securityManager.sessionMode = native > > > > ## DAO for single sign on > > sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO > > securityManager.sessionManager.sessionDAO = $sessionDAO > > > > # cookie for single sign on > > cookie = org.apache.shiro.web.servlet.SimpleCookie > > cookie.name <http://cookie.name> = SSOcookie > > cookie.path = / > > securityManager.sessionManager.sessionIdCookie = $cookie > > > > [urls] > > index.html = authc > > /* = authc > > > > > > > > > > And the error that occurs after the first WAR deployment: > > > > ReflectionBuilder:235 - Encountered object reference > > '$ssoCacheManager'. Looking up object with id 'ssoCacheManager' > > EnvironmentLoader:151 - Shiro environment initialization failed > > org.apache.shiro.config.ConfigurationException: Unable to set property > > 'cacheManager' with value > > [org.apache.shiro.cache.ehcache.EhCacheManager@2c8df9a0] > > on object of type org.apache.shiro.web.mgt.DefaultWebSecurityManager. > > If 'org.apache.shiro.cache.ehcache.EhCacheManager@2c8df9a0' is a > > reference to another (previously defined) object, prefix it with '$' > > to indicate that > > the referenced object should be used as the actual value. For > > example, $org.apache.shiro.cache.ehcache.EhCacheManager@2c8df9a0 > > at > > > org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:448) > > at > > > org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:397) > > at > > > org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:508) > > at > > > org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:203) > > at > > > org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:164) > > at > > > org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124) > > at > > > org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170) > > at > > > org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119) > > at > > > org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97) > > at > > > org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83) > > at > > > org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41) > > at > > > org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123) > > at > > > org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47) > > at > > > org.apache.shiro.web.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203) > > at > > > org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99) > > at > > > org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92) > > at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45) > > at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40) > > at > > > org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:226) > > at > > > org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:138) > > at > > > org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58) > > at > > > org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) > > at > > org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) > > at > > > org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) > > at > > > org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) > > at > > > org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > > at java.lang.Thread.run(Thread.java:662) > > Caused by: java.lang.IllegalArgumentException: Cannot invoke > > org.apache.shiro.mgt.CachingSecurityManager.setCacheManager on bean class > > 'class org.apache.shiro.web.mgt.DefaultWebSecurityManager' - > > argument type mismatch - had objects of type > > "org.apache.shiro.cache.ehcache.EhCacheManager" > > but expected signature "org.apache.shiro.cache.CacheManager" > > at > > > org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2235) > > at > > > org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151) > > at > > > org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957) > > at > > > org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064) > > at > > > org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017) > > at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456) > > at > > > org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:440) > > ... 28 more > > > > > > > > Does anyone know what I am doing wrong here? Any help would be > > greatly appreciated. > > > > Best, > > Ryan Connolly > > > > > > > > >