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

    主站蜘蛛池模板: 亚洲国产模特在线播放| 亚洲国产成a人v在线观看| 日韩精品免费一线在线观看 | 亚洲AV无码国产一区二区三区| 国产精品成人免费一区二区| 精品亚洲456在线播放| 欧美日韩国产免费一区二区三区| 亚洲天堂一区在线| 毛片大全免费观看| 亚洲精品色播一区二区| 日本人护士免费xxxx视频| 亚洲乱人伦中文字幕无码| 国产免费人成在线视频| 一边摸一边爽一边叫床免费视频| 亚洲综合无码精品一区二区三区| 免费无码av片在线观看| 久久国产精品亚洲一区二区| 亚洲免费中文字幕| 亚洲中文精品久久久久久不卡| 国产在线98福利播放视频免费| 一级毛片免费播放试看60分钟| 亚洲精品制服丝袜四区| 黄色免费网站网址| AV激情亚洲男人的天堂国语| 亚洲伊人色欲综合网| 亚洲免费观看网站| 亚洲AV成人精品日韩一区| 亚洲夜夜欢A∨一区二区三区 | 成人免费午夜无码视频| 国产精品亚洲精品爽爽| 国产V亚洲V天堂无码| 免费看男女下面日出水来| 精品亚洲福利一区二区| 国产亚洲美女精品久久久久狼 | 日韩免费a级毛片无码a∨| 色吊丝免费观看网站| 免费观看AV片在线播放| 国产精品亚洲综合网站| 亚洲av丰满熟妇在线播放| 日韩毛片免费在线观看| a国产成人免费视频|