I am so sorry. Typo.  Shiro

thanks

Mike


> 在 2017年8月12日,下午5:24,Mike Guo <hongw...@163.com> 写道:
> 
> hello.  all.
> 
> is there anybody have experiences for use ehcache 3 in Shiro? 
> 
> 
> I tried use it like this:
> 
>       @Bean
>       public DefaultWebSecurityManager securityManager() throws IOException {
>               
> 
>               SessionManager sessionManager = new DefaultWebSessionManager();
>               
>               EhCacheManager cacheManager = new EhCacheManager();
>               cacheManager.setCacheManagerConfigFile(
>                               new 
> ClassPathResource("session-cache.xml").getFile().getAbsolutePath()
>               );
>               
>               DefaultWebSecurityManager securityManager = new 
> DefaultWebSecurityManager();
>               
>               securityManager.setRealm(myRealm());
>               securityManager.setSessionManager(sessionManager);
>               securityManager.setCacheManager(cacheManager);
>               
>               
>               return securityManager;
>               
>       }
>       
> 
> and the content in session-cache.xml like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <config
>     xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance 
> <http://www.w3.org/2001/XMLSchema-instance>'
>     xmlns='http://www.ehcache.org/v3 <http://www.ehcache.org/v3>'
>     xsi:schemaLocation="http://www.ehcache.org/v3 <http://www.ehcache.org/v3> 
> http://www.ehcache.org/schema/ehcache-core.xsd 
> <http://www.ehcache.org/schema/ehcache-core.xsd>">
> 
>   <cache alias="shiro-activeSessionCache"> 
>     <resources>
>       <heap unit="entries">2000</heap> 
>       <offheap unit="MB">500</offheap> 
>     </resources>
>   </cache>
> 
> 
> </config>
> 
> 
> 
> but system report a error.   
> 
>       ... 89 more
> Caused by: org.springframework.beans.BeanInstantiationException: Failed to 
> instantiate 
> [org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor]:
>  Factory method 'authorizationAttributeSourceAdvisor' threw exception; nested 
> exception is org.springframework.beans.factory.BeanCreationException: Error 
> creating bean with name 'securityManager' defined in 
> com.fbcglobal.customer.config.RootConfig: Bean instantiation via factory 
> method failed; nested exception is 
> org.springframework.beans.BeanInstantiationException: Failed to instantiate 
> [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Factory method 
> 'securityManager' threw exception; nested exception is 
> org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Error 
> configuring from input stream. Initial cause was null:6: Element <config> 
> does not allow attribute "xmlns:xsi".
>       at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
>       at 
> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
>       ... 106 more
> 
> 
> 
> it that mean  Shiro doesn’t support ehcache 3?
> 
> 
> 
> if it support it,  would you point me a way?
> 
> 
> Many thanks
> 
> 
> Mike
> 

Reply via email to