<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技術

    主站蜘蛛池模板: 亚洲毛片免费视频| 1000部免费啪啪十八未年禁止观看 | 国产乱辈通伦影片在线播放亚洲| 亚欧在线精品免费观看一区| 成全视成人免费观看在线看| 最新亚洲人成无码网站| 亚洲欧美一区二区三区日产| 亚洲成a人片在线观看中文!!!| 日本红怡院亚洲红怡院最新| 亚洲精品国精品久久99热| 日本一道本高清免费| 国产婷婷高清在线观看免费| 成人爽A毛片免费看| 国产大片免费网站不卡美女| 97在线视频免费播放| 免费无码中文字幕A级毛片| 99久在线国内在线播放免费观看 | 久久久久无码专区亚洲av| 亚洲成A∨人片天堂网无码| 国产亚洲精品拍拍拍拍拍| 国产av天堂亚洲国产av天堂 | 久久一区二区免费播放| 免费看又黄又无码的网站| 永久在线观看www免费视频| 久久精品女人天堂AV免费观看| 国产高清视频在线免费观看| 亚洲AⅤ永久无码精品AA| 亚洲国产精华液网站w| 亚洲乱码中文字幕小综合| 亚洲老熟女五十路老熟女bbw| 免费夜色污私人影院网站电影 | 亚洲国产中文字幕在线观看| 亚洲黄色免费观看| 国产精品无码亚洲一区二区三区| 国产在线精品一区免费香蕉| 波多野结衣中文字幕免费视频| 免费播放春色aⅴ视频| 亚洲婷婷在线视频| 国产免费一区二区三区在线观看| 手机在线毛片免费播放| 蜜芽亚洲av无码精品色午夜|