I was hoping someone might have some insight into an issue I'm having...

I'm using Spring to manage Shiro config and I'm attempting to set up EhCache 
for session management for my web application.  I'm getting the following error:

Another unnamed CacheManager already exists in the same VM. Please provide 
unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same 
CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: InputStreamConfigurationSource 
[stream=java.io.ByteArrayInputStream@29989e7c]

I didn't follow any Spring specific documentation regarding my configuration 
cache management.  Instead, I tried to carve my own path by reading the docs 
specific to shiro.ini configuration and came up with this for my 
applicationContext.xml:

<bean id="shiroSessionDao" 
class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO" 
scope="singleton" />
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager" 
scope="singleton" />

<bean id="shiroSessionManager" 
class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
                <property name="sessionDAO" ref="shiroSessionDao" />
</bean>

<bean id="securityManager" 
class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
                <property name="realm" ref="oaiRealm" />
                <property name="sessionManager" ref="shiroSessionManager" />
                <property name="cacheManager" ref="cacheManager" />
</bean>

Eventually, the securityManager bean is referenced in the shiroFilter bean.  
However, the error I'm getting leads me to believe that I'm not going down the 
right path in how I've set up the relationships above.

Can anyone assist me?

Mike

Reply via email to