开发者社区> 问答> 正文

shiro配置问题,我配置了缓存然后自己重写了一个Realm,冲突:报错

public class MyShiroRealm extends AuthorizingRealm {

	@Override
	protected AuthorizationInfo doGetAuthorizationInfo(
			PrincipalCollection principals) {

		return null;
	}

	@Override
	protected AuthenticationInfo doGetAuthenticationInfo(
			AuthenticationToken authcToken) throws AuthenticationException {
		UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
		return null;
	}

}

shiro.ini配置文件信息

[main]
shiroDbRealm = com.XXX.MyShiroRealm
securityManager.realms = $shiroDbRealm

sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionDAO.activeSessionsCacheName = shiro-activeSessionsCache
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile = classpath:ehcache-shiro.xml
securityManager.cacheManager = $cacheManager
 
2013-5-31 14:57:43 org.eclipse.jetty.server.handler.ContextHandler$Context log
信息: Initializing Shiro environment
2013-5-31 14:57:43 org.apache.shiro.web.env.EnvironmentLoader initEnvironment
信息: Starting Shiro environment initialization.
2013-5-31 14:57:44 org.apache.shiro.cache.ehcache.EhCacheManager getCache
信息: Cache with name 'shiroDbRealm.authorizationCache' does not yet exist.  Creating now.
2013-5-31 14:57:44 org.apache.shiro.cache.ehcache.EhCacheManager getCache
信息: Added EhCache named [shiroDbRealm.authorizationCache]
2013-5-31 14:57:44 org.apache.shiro.config.IniSecurityManagerFactory isAutoApplyRealms
信息: Realms have been explicitly set on the SecurityManager instance - auto-setting of realms will not occur.
2013-5-31 14:57:44 org.apache.shiro.web.env.EnvironmentLoader initEnvironment
信息: Shiro environment initialized in 1302 ms.
2013-5-31 14:57:44 org.eclipse.jetty.server.handler.ContextHandler callContextInitialized
信息: started o.e.j.w.WebAppContext{/,file:/Users/yinjun622/git/Aloha/Aloha/WebRoot/}
2013-5-31 14:57:45 org.eclipse.jetty.util.component.AbstractLifeCycle setFailed
警告: FAILED jfinal: java.lang.RuntimeException: Plugin start error: com.earlybird.aloha.plugin.ShiroPlugin. 
Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
java.lang.RuntimeException: Plugin start error: com.earlybird.aloha.plugin.ShiroPlugin. 
Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
	at com.jfinal.core.Config.startPlugins(Config.java:88)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:68)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:117)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:165)
	at com.earlybird.aloha.config.Myconfig.main(Myconfig.java:131)
Caused by: org.apache.shiro.config.ConfigurationException: Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:448)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:397)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:508)
	at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:203)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:164)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at com.earlybird.aloha.plugin.ShiroPlugin.start(ShiroPlugin.java:18)
	at com.jfinal.core.Config.startPlugins(Config.java:78)
	... 18 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2170)
	at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)
	at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)
	at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)
	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:440)
	... 32 more
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224)
	at org.apache.shiro.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:156)
	at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:245)
	at org.apache.shiro.realm.AuthorizingRealm.getAvailableAuthorizationCache(AuthorizingRealm.java:260)
	at org.apache.shiro.realm.AuthorizingRealm.afterCacheManagerSet(AuthorizingRealm.java:226)
	at org.apache.shiro.realm.CachingRealm.setCacheManager(CachingRealm.java:96)
	at org.apache.shiro.mgt.RealmSecurityManager.applyCacheManagerToRealms(RealmSecurityManager.java:115)
	at org.apache.shiro.mgt.RealmSecurityManager.afterCacheManagerSet(RealmSecurityManager.java:127)
	at org.apache.shiro.mgt.SessionsSecurityManager.afterCacheManagerSet(SessionsSecurityManager.java:103)
	at org.apache.shiro.mgt.CachingSecurityManager.setCacheManager(CachingSecurityManager.java:72)
	... 43 more
Caused by: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:529)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:374)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:339)
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:213)
	... 52 more
2013-5-31 14:57:45 org.eclipse.jetty.webapp.WebAppContext doStart
警告: Failed startup of context o.e.j.w.WebAppContext{/,file:/Users/yinjun622/git/Aloha/Aloha/WebRoot/}
java.lang.RuntimeException: Plugin start error: com.earlybird.aloha.plugin.ShiroPlugin. 
Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
	at com.jfinal.core.Config.startPlugins(Config.java:88)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:68)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:117)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:165)
	at com.earlybird.aloha.config.Myconfig.main(Myconfig.java:131)
Caused by: org.apache.shiro.config.ConfigurationException: Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:448)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:397)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:508)
	at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:203)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:164)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at com.earlybird.aloha.plugin.ShiroPlugin.start(ShiroPlugin.java:18)
	at com.jfinal.core.Config.startPlugins(Config.java:78)
	... 18 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2170)
	at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)
	at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)
	at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)
	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:440)
	... 32 more
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224)
	at org.apache.shiro.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:156)
	at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:245)
	at org.apache.shiro.realm.AuthorizingRealm.getAvailableAuthorizationCache(AuthorizingRealm.java:260)
	at org.apache.shiro.realm.AuthorizingRealm.afterCacheManagerSet(AuthorizingRealm.java:226)
	at org.apache.shiro.realm.CachingRealm.setCacheManager(CachingRealm.java:96)
	at org.apache.shiro.mgt.RealmSecurityManager.applyCacheManagerToRealms(RealmSecurityManager.java:115)
	at org.apache.shiro.mgt.RealmSecurityManager.afterCacheManagerSet(RealmSecurityManager.java:127)
	at org.apache.shiro.mgt.SessionsSecurityManager.afterCacheManagerSet(SessionsSecurityManager.java:103)
	at org.apache.shiro.mgt.CachingSecurityManager.setCacheManager(CachingSecurityManager.java:72)
	... 43 more
Caused by: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:529)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:374)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:339)
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:213)
	... 52 more

2013-05-31 14:57:45
[ERROR]-[Thread: main]-[com.jfinal.core.Config.startPlugins()]: Plugin start error: com.earlybird.aloha.plugin.ShiroPlugin. 
Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
org.apache.shiro.config.ConfigurationException: Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@590eb535] on object of type org.apache.shiro.mgt.DefaultSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@590eb535' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@590eb535
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:448)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:397)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:508)
	at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:203)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:164)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at com.earlybird.aloha.plugin.ShiroPlugin.start(ShiroPlugin.java:18)
	at com.jfinal.core.Config.startPlugins(Config.java:78)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:68)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
	at org.eclipse.jetty.server.Server.doStart(Server.java:277)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
	at com.jfinal.server.JettyServer.doStart(JettyServer.java:117)
	at com.jfinal.server.JettyServer.start(JettyServer.java:64)
	at com.jfinal.core.JFinal.start(JFinal.java:165)
	at com.earlybird.aloha.config.Myconfig.main(Myconfig.java:131)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2170)
	at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)
	at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)
	at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)
	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:440)
	... 32 more
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224)
	at org.apache.shiro.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:156)
	at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:245)
	at org.apache.shiro.realm.AuthorizingRealm.getAvailableAuthorizationCache(AuthorizingRealm.java:260)
	at org.apache.shiro.realm.AuthorizingRealm.afterCacheManagerSet(AuthorizingRealm.java:226)
	at org.apache.shiro.realm.CachingRealm.setCacheManager(CachingRealm.java:96)
	at org.apache.shiro.mgt.RealmSecurityManager.applyCacheManagerToRealms(RealmSecurityManager.java:115)
	at org.apache.shiro.mgt.RealmSecurityManager.afterCacheManagerSet(RealmSecurityManager.java:127)
	at org.apache.shiro.mgt.SessionsSecurityManager.afterCacheManagerSet(SessionsSecurityManager.java:103)
	at org.apache.shiro.mgt.CachingSecurityManager.setCacheManager(CachingSecurityManager.java:72)
	... 43 more
Caused by: net.sf.ehcache.CacheException: Another unnamed 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: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@5082277]
	at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:529)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:374)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:339)
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:213)
	... 52 more
2013-5-31 14:57:45 org.eclipse.jetty.server.AbstractConnector doStart
信息: Started SelectChannelConnector@0.0.0.0:8080
Starting Complete. Welcome To The JFinal World :)

展开
收起
kun坤 2020-06-14 07:06:00 871 0
1 条回答
写回答
取消 提交回答
  • 我使用的是JFinal并在JFinal中添加了Shiro作为插件,发现在JFinal中多运行了Shiro一次所以出错

    ######没用过shiro,看样子是 cacheManager 引用了其他依赖,需要以$+value方式引用######初始化Realms的时候会运行cacheManager,然后我配置cachemanager又会运行~shiro应该有处理机制把~~
    2020-06-14 07:06:07
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
基于英特尔 SSD 的虚拟机缓存解决SSD 立即下载
用户态高速块缓存方案 立即下载
高性能Web架构之缓存体系 立即下载