net.sf.ehcache.CacheException: java.io.OptionalDataException

2024-03-06 02:18

本文主要是介绍net.sf.ehcache.CacheException: java.io.OptionalDataException,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

org.apache.shiro.cache.CacheException: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException 

异常信息:

 2021-02-20 16:34:24,289 WARN [org.apache.shiro.authc.AbstractAuthenticator] - Authentication failed for token submission [com.idra.sys.security.UsernamePasswordToken - admin, rememberMe=false (192.168.10.202)].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
org.apache.shiro.cache.CacheException: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at org.apache.shiro.cache.ehcache.EhCache.values(EhCache.java:182)
        at org.apache.shiro.session.mgt.eis.CachingSessionDAO.getActiveSessions(CachingSessionDAO.java:345)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:144)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:128)
        at com.idra.sys.security.SystemAuthorizingRealm.doGetAuthenticationInfo(SystemAuthorizingRealm.java:63)
        at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
        at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
        at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
        at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
        at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
        at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
        at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
        at org.apache.shiro.web.filter.authc.AuthenticatingFilter.executeLogin(AuthenticatingFilter.java:53)
        at org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied(FormAuthenticationFilter.java:154)
        at org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied(AccessControlFilter.java:133)
        at org.apache.shiro.web.filter.AccessControlFilter.onPreHandle(AccessControlFilter.java:162)
        at org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued(PathMatchingFilter.java:203)
        at org.apache.shiro.web.filter.PathMatchingFilter.preHandle(PathMatchingFilter.java:178)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:131)
        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)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:85)
        at org.apache.shiro.cache.ehcache.EhCache.values(EhCache.java:172)
        ... 50 more
Caused by: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:891)
        at net.sf.ehcache.store.disk.Segment.decodeHit(Segment.java:182)
        at net.sf.ehcache.store.disk.Segment.get(Segment.java:225)
        at net.sf.ehcache.store.disk.DiskStore.fault(DiskStore.java:210)
        at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:198)
        at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:192)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.get(OnHeapCachingTier.java:334)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.access$200(OnHeapCachingTier.java:311)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier.get(OnHeapCachingTier.java:175)
        at net.sf.ehcache.store.CacheStore.get(CacheStore.java:192)
        at net.sf.ehcache.Cache.get(Cache.java:1751)
        at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:73)
        ... 51 more
Caused by: java.io.OptionalDataException
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1592)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at java.util.HashMap.readObject(HashMap.java:1407)
        at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at org.apache.shiro.session.mgt.SimpleSession.readObject(SimpleSession.java:500)
        at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2286)
        at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:560)
        at net.sf.ehcache.Element.readObject(Element.java:884)
        at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:371)
        at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:887)
        ... 62 more
2021-02-20 16:34:24,301 ERROR [com.idra.sys.security.FormAuthenticationFilter] - org.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [com.idra.sys.security.UsernamePasswordToken - admin, rememberMe=false (192.168.10.202)].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
        at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:214)
        at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
        at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
        at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
        at org.apache.shiro.web.filter.authc.AuthenticatingFilter.executeLogin(AuthenticatingFilter.java:53)
        at org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied(FormAuthenticationFilter.java:154)
        at org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied(AccessControlFilter.java:133)
        at org.apache.shiro.web.filter.AccessControlFilter.onPreHandle(AccessControlFilter.java:162)
        at org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued(PathMatchingFilter.java:203)
        at org.apache.shiro.web.filter.PathMatchingFilter.preHandle(PathMatchingFilter.java:178)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:131)
        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)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.shiro.cache.CacheException: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at org.apache.shiro.cache.ehcache.EhCache.values(EhCache.java:182)
        at org.apache.shiro.session.mgt.eis.CachingSessionDAO.getActiveSessions(CachingSessionDAO.java:345)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:144)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:128)
        at com.idra.sys.security.SystemAuthorizingRealm.doGetAuthenticationInfo(SystemAuthorizingRealm.java:63)
        at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
        at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
        at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
        at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
        ... 42 more
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:85)
        at org.apache.shiro.cache.ehcache.EhCache.values(EhCache.java:172)
        ... 50 more
Caused by: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:891)
        at net.sf.ehcache.store.disk.Segment.decodeHit(Segment.java:182)
        at net.sf.ehcache.store.disk.Segment.get(Segment.java:225)
        at net.sf.ehcache.store.disk.DiskStore.fault(DiskStore.java:210)
        at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:198)
        at net.sf.ehcache.store.CacheStore$4.call(CacheStore.java:192)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.get(OnHeapCachingTier.java:334)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.access$200(OnHeapCachingTier.java:311)
        at net.sf.ehcache.store.cachingtier.OnHeapCachingTier.get(OnHeapCachingTier.java:175)
        at net.sf.ehcache.store.CacheStore.get(CacheStore.java:192)
        at net.sf.ehcache.Cache.get(Cache.java:1751)
        at org.apache.shiro.cache.ehcache.EhCache.get(EhCache.java:73)
        ... 51 more
Caused by: java.io.OptionalDataException
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1592)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at java.util.HashMap.readObject(HashMap.java:1407)
        at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at org.apache.shiro.session.mgt.SimpleSession.readObject(SimpleSession.java:500)
        at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2286)
        at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:560)
        at net.sf.ehcache.Element.readObject(Element.java:884)
        at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
        at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:371)
        at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:887)
        ... 62 more

ehcache配置文件:ehcache-local.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
    updateCheck="false" 
    name="defaultCache">

    <!-- 默认的临时文件路径  -->
    <diskStore path="java.io.tmpdir" />

    
        <!-- 默认缓存配置. -->
        <!-- <defaultCache maxEntriesLocalHeap="100" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600"
                overflowToDisk="true" maxEntriesLocalDisk="100000" /> -->
        <defaultCache eternal="false"   
        maxElementsInMemory="1000"  
        overflowToDisk="false"   
        diskPersistent="false"   
        timeToIdleSeconds="0"  
        timeToLiveSeconds="600"   
        memoryStoreEvictionPolicy="LFU" />

        <cache name="myCache"   
        eternal="false"   
        maxElementsInMemory="500"  
        overflowToDisk="false"   
        diskPersistent="false"   
        timeToIdleSeconds="0"  
        timeToLiveSeconds="300"   
        memoryStoreEvictionPolicy="LFU" />

        <!-- 系统缓存 -->
        <cache name="sysCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true"/>

        <!-- 用户缓存 -->
        <cache name="userCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true"/>

        <!-- 系统活动会话缓存 -->
    <cache name="activeSessionsCache" maxEntriesLocalHeap="10000" overflowToDisk="true"
           eternal="true" timeToLiveSeconds="0" timeToIdleSeconds="0"
           diskPersistent="true" diskExpiryThreadIntervalSeconds="600"/>
    
</ehcache>

问题解决:

找到缓存目录,删除缓存文件,重启tomcat(把tomcat路径下temp文件夹中shiro产生的缓存文件删除,然后重新运行)

我的缓存目录是tomcat/temp文件夹下(见上面代码块中红色的位置)

[*** temp]# ll 
-rw-r--r--. 1 root root 1321166 2月  20 17:32 active%0053essions%0043ache.data
-rw-r--r--. 1 root root    2325 2月  20 17:00 sys%0043ache.data
-rw-r--r--. 1 root root    3674 2月  20 17:00 user%0043ache.data
[*** temp]# pwd
/thirdtools/apache-tomcat-7.0.94/temp

问题分析:

异常

 Caused by: org.apache.shiro.cache.CacheException: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
        at org.apache.shiro.cache.ehcache.EhCache.values(EhCache.java:182)
        at org.apache.shiro.session.mgt.eis.CachingSessionDAO.getActiveSessions(CachingSessionDAO.java:345)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:144)
        at com.idra.common.security.shiro.session.CacheSessionDAO.getActiveSessions(CacheSessionDAO.java:128)

抛异常代码位置 (我用的是 shiro-core-1.2.5.jar)

package org.apache.shiro.session.mgt.eis;

public abstract class CachingSessionDAO extends AbstractSessionDAO implements CacheManagerAware {

    略……

    
    /**
     * Returns all active sessions in the system.
     * <p/>
     * <p>This implementation merely returns the sessions found in the activeSessions cache.  Subclass implementations
     * may wish to override this method to retrieve them in a different way, perhaps by an RDBMS query or by other
     * means.
     *
     * @return the sessions found in the activeSessions cache.
     */
    public Collection<Session> getActiveSessions() {
        Cache<Serializable, Session> cache = getActiveSessionsCacheLazy();
        if (cache != null) {
            return cache.values();
        } else {
            return Collections.emptySet();
        }
    }
}
 

 异常所在行

这篇关于net.sf.ehcache.CacheException: java.io.OptionalDataException的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/778560

相关文章

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

SpringBoot实现数据库读写分离的3种方法小结

《SpringBoot实现数据库读写分离的3种方法小结》为了提高系统的读写性能和可用性,读写分离是一种经典的数据库架构模式,在SpringBoot应用中,有多种方式可以实现数据库读写分离,本文将介绍三... 目录一、数据库读写分离概述二、方案一:基于AbstractRoutingDataSource实现动态

Springboot @Autowired和@Resource的区别解析

《Springboot@Autowired和@Resource的区别解析》@Resource是JDK提供的注解,只是Spring在实现上提供了这个注解的功能支持,本文给大家介绍Springboot@... 目录【一】定义【1】@Autowired【2】@Resource【二】区别【1】包含的属性不同【2】@

springboot循环依赖问题案例代码及解决办法

《springboot循环依赖问题案例代码及解决办法》在SpringBoot中,如果两个或多个Bean之间存在循环依赖(即BeanA依赖BeanB,而BeanB又依赖BeanA),会导致Spring的... 目录1. 什么是循环依赖?2. 循环依赖的场景案例3. 解决循环依赖的常见方法方法 1:使用 @La

Java枚举类实现Key-Value映射的多种实现方式

《Java枚举类实现Key-Value映射的多种实现方式》在Java开发中,枚举(Enum)是一种特殊的类,本文将详细介绍Java枚举类实现key-value映射的多种方式,有需要的小伙伴可以根据需要... 目录前言一、基础实现方式1.1 为枚举添加属性和构造方法二、http://www.cppcns.co

Elasticsearch 在 Java 中的使用教程

《Elasticsearch在Java中的使用教程》Elasticsearch是一个分布式搜索和分析引擎,基于ApacheLucene构建,能够实现实时数据的存储、搜索、和分析,它广泛应用于全文... 目录1. Elasticsearch 简介2. 环境准备2.1 安装 Elasticsearch2.2 J

Java中的String.valueOf()和toString()方法区别小结

《Java中的String.valueOf()和toString()方法区别小结》字符串操作是开发者日常编程任务中不可或缺的一部分,转换为字符串是一种常见需求,其中最常见的就是String.value... 目录String.valueOf()方法方法定义方法实现使用示例使用场景toString()方法方法

Java中List的contains()方法的使用小结

《Java中List的contains()方法的使用小结》List的contains()方法用于检查列表中是否包含指定的元素,借助equals()方法进行判断,下面就来介绍Java中List的c... 目录详细展开1. 方法签名2. 工作原理3. 使用示例4. 注意事项总结结论:List 的 contain

Java实现文件图片的预览和下载功能

《Java实现文件图片的预览和下载功能》这篇文章主要为大家详细介绍了如何使用Java实现文件图片的预览和下载功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... Java实现文件(图片)的预览和下载 @ApiOperation("访问文件") @GetMapping("

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis