<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    cuiyi's blog(崔毅 crazycy)

    記錄點滴 鑒往事之得失 以資于發展
    數據加載中……

    SpringMVC+MyBatis - 8 Shiro異常:EhCache initialization exception: Another unnamed CacheManager already exists in the same VM

    異常1: EhCache initialization exception: Another unnamed CacheManager already exists in the same VM
    具體錯誤如下:
    Another CacheManager with same name '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: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]

    一般材料是這樣說的:
    <bean id="ehCacheManager" 
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
        p:configLocation="classpath:org/tradinglink/cache/echcache-shiro.xml"
        p:shared="true"/>

    但是經過實踐是要這樣做的:
    <bean id="shiroEncacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
    <property name="cacheManager" ref="ehCacheManager"/>
    </bean>
    <bean id="ehCacheManager" 
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
        p:configLocation="classpath:org/tradinglink/cache/echcache-shiro.xml"
        p:shared="true"/>

    一段關于完整的配置如下
    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
    <property name="securityManager" ref="securityManager" />
    <property name="loginUrl" value="/login.jsp" />
    <property name="successUrl" value="/index.jsp" />
    <property name="unauthorizedUrl" value="/unauthorized.jsp" />
    <property name="filters">
    <map>
    <entry key="authc" value-ref="formAuthenticationFilter"></entry>
    </map>
    </property>
    <!-- will config in db, and then read into filterChainDefinitionsMap property -->
    <property name="filterChainDefinitions">
    <value>
    /login = authc
    /logout = logout
    /resource/** = anon
    /images/**= anon
    /css/**= anon
    /javascript/**= anon
    <!-- /welcome = perms[accout:edit] -->
    <!-- /security/account/view.do=authc,perms[SECURITY_ACCOUNT_VIEW] -->
    /** = anon
    </value>
    </property>
    </bean>

    <!--一段關于securityManager的完整的配置如下-->
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
        <property name="realm" ref="myRealm"/>
        <property name="sessionMode" value="native"/>
        <property name="sessionManager" ref="sessionManager"/>
        <property name="cacheManager" ref="cacheManager"/>
    </bean>

    <bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
        <property name="cacheManager" ref="ehCacheManager"/>
    </bean>

    <bean id="ehCacheManager" 
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>

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

    <bean id="sessionDAO" 
        class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
        <property name="activeSessionsCacheName" value="shiro-activeSessionCache" />
    </bean>
    <bean id="myRealm" class="com.foo.MyRealm"/>

    posted on 2014-07-13 00:07 crazycy 閱讀(5331) 評論(0)  編輯  收藏 所屬分類: JavaEE技術

    主站蜘蛛池模板: 九九九国产精品成人免费视频| 97se亚洲综合在线| 亚洲AV无码成人精品区狼人影院| 亚洲国产精品无码久久久久久曰| 亚洲欧美日韩综合俺去了| 杨幂最新免费特级毛片| 国产午夜鲁丝片AV无码免费| 久久精品国产精品亚洲精品 | 日本亚洲精品色婷婷在线影院| 99精品免费观看| 亚洲精品在线不卡| 一二三区免费视频| 亚洲精品无码永久中文字幕| 亚洲精品国产首次亮相| 日韩一级视频免费观看| 亚洲精品国产日韩无码AV永久免费网 | 美女视频黄.免费网址| 免费观看无遮挡www的小视频| 日本免费中文字幕在线看| 国产亚洲视频在线观看网址| 91免费精品国自产拍在线不卡| 亚洲人成影院在线无码按摩店| 国产成人AV片无码免费| 亚洲一区精彩视频| 亚洲国产精品无码久久青草| 永久免费AV无码网站国产| 亚洲国产亚洲综合在线尤物| 日本无吗免费一二区| 久久久受www免费人成| 91亚洲国产成人精品下载| 超pen个人视频国产免费观看| 亚洲国产情侣一区二区三区| 啦啦啦高清视频在线观看免费| 亚洲福利一区二区| 国产色爽免费视频| 男女作爱在线播放免费网站| 2020天堂在线亚洲精品专区| 亚洲欧洲日本在线| 成年网站免费视频A在线双飞| 欧洲美女大片免费播放器视频| 久久精品国产亚洲av水果派|