<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 閱讀(5344) 評論(0)  編輯  收藏 所屬分類: JavaEE技術

    主站蜘蛛池模板: 日批视频网址免费观看| 中文字幕免费视频精品一| av无码东京热亚洲男人的天堂| 特级毛片A级毛片免费播放| 亚洲AV无码国产在丝袜线观看| www.黄色免费网站| 一级黄色毛片免费看| 亚洲乱码日产精品BD在线观看| 国产伦一区二区三区免费| 久久午夜无码免费| 亚洲性色AV日韩在线观看| 久久国产成人精品国产成人亚洲 | 7723日本高清完整版免费| 国产精品亚洲专区在线播放| 久久久久亚洲AV片无码下载蜜桃| 国产免费资源高清小视频在线观看| 免费福利在线视频| 看亚洲a级一级毛片| 久久久久亚洲AV片无码下载蜜桃 | 亚洲国产精品综合久久20| 久久亚洲精品无码播放| 成年女人看片免费视频播放器| 国产午夜精品久久久久免费视 | 亚洲精品无码av人在线观看 | 日本特黄特黄刺激大片免费| 97av免费视频| 中国一级特黄的片子免费 | 亚洲av丰满熟妇在线播放| 亚洲国产另类久久久精品小说| 久久精品夜色国产亚洲av| 亚洲成a人片在线看| 精品无码国产污污污免费网站国产 | 免费精品视频在线| 一个人免费视频观看在线www | 国产亚洲精品a在线观看| 国内免费高清在线观看| 久久99国产乱子伦精品免费| 一个人看的免费高清视频日本| 亚洲欧洲精品成人久久曰| 亚洲日韩中文字幕天堂不卡| 国产A在亚洲线播放|