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

    主站蜘蛛池模板: 免费精品视频在线| 亚洲中文字幕一区精品自拍| 一日本道a高清免费播放| 四只虎免费永久观看| 亚洲.国产.欧美一区二区三区| 无码中文在线二区免费| 中中文字幕亚洲无线码| 成人毛片18女人毛片免费视频未| 亚洲中文字幕日本无线码| 成人免费网站在线观看| 亚洲精品无码专区久久| 又粗又硬又黄又爽的免费视频| 苍井空亚洲精品AA片在线播放| 国产免费午夜a无码v视频| 国产精品久久久久久亚洲小说 | 国产精品亚洲产品一区二区三区| 羞羞视频免费网站含羞草| 亚洲av麻豆aⅴ无码电影| 两个人日本WWW免费版| 中文亚洲AV片在线观看不卡| 成人精品视频99在线观看免费| 亚洲午夜久久久久久久久久| 精品一卡2卡三卡4卡免费视频| 久久亚洲国产精品成人AV秋霞| 在线观看的免费网站| 日本一区二区在线免费观看| 亚洲情XO亚洲色XO无码| 四虎影视成人永久免费观看视频| 亚洲www在线观看| 免费人成视频在线观看视频| 中国一级毛片视频免费看| 亚洲日韩中文字幕天堂不卡| 日韩一区二区三区免费体验| AAAAA级少妇高潮大片免费看| 亚洲AV综合色区无码一区爱AV | 天天爽亚洲中文字幕| 亚洲不卡AV影片在线播放| 香蕉免费看一区二区三区| 久久99亚洲网美利坚合众国| 国产精品无码一二区免费 | 亚洲另类春色国产精品|