我正在使用shiro进行身份验证以及启用SSO的ehcache.xml。
我的ehcache.xml看起来像
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true" name="my-cache">
<diskStore path="java.io.tmpdir/mycache" />
<cache name="shiro-activeSessionCache" maxElementsInMemory="1000"
eternal="true" overflowToDisk="true" memoryStoreEvictionPolicy="LFU">
</cache>
<defaultCache maxElementsInMemory="100" eternal="true"
overflowToDisk="true" memoryStoreEvictionPolicy="LFU">
</defaultCache>
</ehcache>
我有一个如下工厂类
public class SharedEhCacheManagerFactory implements Factory<CacheManager> {
private String cacheManagerConfigFile = "/ehcache.xml";
@Override
public CacheManager getInstance()
{
return CacheManager.create(readCacheManagerConfigFileAsInputStream());
}
public InputStream readCacheManagerConfigFileAsInputStream()
{
InputStream is = getClass().getResourceAsStream(cacheManagerConfigFile);
return is;
}
}
我的所有webapps的shiro.ini文件主要部分就像
[main]
ehCacheManager = com.nokia.anv.app.security.service.SharedEhCacheManagerFactory
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManager=$ehCacheManager
securityManager.cacheManager = $cacheManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionDAO = $sessionDAO
cookie = org.apache.shiro.web.servlet.SimpleCookie
cookie.name = SSOCookie
cookie.path = /
sessionManager.sessionIdCookie = $cookie
sessionManager.sessionIdUrlRewritingEnabled = false
securityManager.sessionManager = $sessionManager
我正在使用apache karaf,这个应用程序来自一个docker容器。当我第一次启动容器时一切都很好,但如果我停止并启动容器,我会收到大多数应用程序的错误,如
javax.servlet.ServletException: java.lang.IllegalStateException: The CacheManager has been shut down. It can no longer be used.
at org.apache.shiro.web.servlet.AdviceFilter.cleanup(AdviceFilter.java:196)
at org.apache.shiro.web.filter.authc.AuthenticatingFilter.cleanup(AuthenticatingFilter.java:155)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:148)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
但总是两个应用程序都没问题。请告诉我这是什么问题。
答案 0 :(得分:1)
我猜是在调用CacheManager中的subset(spreadgrades, is.na(first) & !is.na(Grade))
方法。你可以添加一些日志记录或设置一个断点来计算罪魁祸首。