开发者社区> 问答> 正文

springmvc+shiro+ehcache+mybatis项目缓存异常,ne?400报错

同事进行业务操作,发现系统报错,而且同一账户登录我的电脑报错,登录其他电脑正常登录,查看日志显示:对于即将到来的请求无法更新当前session的最近访问时间,请问谁知道怎么回事,网上看了好多,也没有具体解决方案,以下错误日志和ehcache配置信息:

错误日志信息:

2017-10-11 09:12:58,095 [http-bio-80-exec-11] ERROR [org.apache.shiro.web.servlet.AbstractShiroFilter] - session.touch() method invocation has failed.  Unable to updatethe corresponding session's last access time based on the incoming request.
org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.OptionalDataException
	at org.apache.shiro.cache.ehcache.EhCache.put(EhCache.java:105)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:247)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:235)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.update(CachingSessionDAO.java:280)
	at org.apache.shiro.session.mgt.DefaultSessionManager.onChange(DefaultSessionManager.java:212)
	at org.apache.shiro.session.mgt.AbstractNativeSessionManager.touch(AbstractNativeSessionManager.java:193)
	at com.epm.edward.common.security.shiro.session.SessionManager.touch(SessionManager.java:114)
	at org.apache.shiro.session.mgt.DelegatingSession.touch(DelegatingSession.java:120)
	at org.apache.shiro.session.ProxiedSession.touch(ProxiedSession.java:100)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.updateSessionLastAccessTime(AbstractShiroFilter.java:315)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:364)
	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:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: net.sf.ehcache.CacheException: java.io.OptionalDataException
	at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:888)
	at net.sf.ehcache.store.disk.Segment.decode(Segment.java:172)
	at net.sf.ehcache.store.disk.Segment.put(Segment.java:449)
	at net.sf.ehcache.store.disk.DiskStore.put(DiskStore.java:438)
	at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:267)
	at net.sf.ehcache.Cache.putInternal(Cache.java:1455)
	at net.sf.ehcache.Cache.put(Cache.java:1383)
	at net.sf.ehcache.Cache.put(Cache.java:1348)
	at org.apache.shiro.cache.ehcache.EhCache.put(EhCache.java:102)
	... 37 more
Caused by: java.io.OptionalDataException
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1373)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
	at java.util.HashMap.readObject(HashMap.java:1179)
	at sun.reflect.GeneratedMethodAccessor511.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1907)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1806)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
	at org.apache.shiro.session.mgt.SimpleSession.readObject(SimpleSession.java:500)
	at sun.reflect.GeneratedMethodAccessor635.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1907)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1806)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2016)
	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:503)
	at net.sf.ehcache.Element.readObject(Element.java:844)
	at sun.reflect.GeneratedMethodAccessor634.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1907)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1806)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
	at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:370)
	at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:886)
	... 45 more

ehcache配置文件:ehcache-local.xml

<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false" name="defaultCache">

	<diskStore path="../temp/epmsite/ehcache" />

	<!-- 默认缓存配置. 自动失效:最后一次访问时间间隔300秒失效,若没有访问过自创建时间600秒失效。-->
	<defaultCache maxEntriesLocalHeap="1000" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600"
		overflowToDisk="true" statistics="true"/>
	
	<!-- 系统缓存 -->
	<cache name="sysCache" maxEntriesLocalHeap="1000" eternal="true" overflowToDisk="true" statistics="true"/>
	
	<!-- 用户缓存 -->
	<cache name="userCache" maxEntriesLocalHeap="1000" eternal="true" overflowToDisk="true" statistics="true"/>
	
	<!-- 集团缓存 -->
	<cache name="corpCache" maxEntriesLocalHeap="1000" eternal="true" overflowToDisk="true" statistics="true"/>
	
	<!-- 内容管理模块缓存 -->
	<cache name="cmsCache" maxEntriesLocalHeap="1000" eternal="true" overflowToDisk="true" statistics="true"/>
    
	<!-- 工作流模块缓存 -->
	<cache name="actCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true" statistics="true"/>
	
    <!-- 简单页面缓存 -->
    <cache name="pageCachingFilter" maxEntriesLocalHeap="1000" eternal="false" timeToIdleSeconds="120"
    	timeToLiveSeconds="120" overflowToDisk="true" memoryStoreEvictionPolicy="LFU" statistics="true"/>
	
	<!-- 系统活动会话缓存 -->
    <cache name="activeSessionsCache" maxEntriesLocalHeap="10000" eternal="true" overflowToDisk="true"
           diskPersistent="true" diskExpiryThreadIntervalSeconds="600" statistics="true"/>
    	
</ehcache>


 

展开
收起
爱吃鱼的程序员 2020-06-08 10:21:04 1111 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    从异常堆栈信息可以看出是读入对象时发生了异常,检查文件是否存在、文件内容是否合法,…

    能否看一下你缓存的东西?是否实现了Serializable 

    谢谢大家,我终于找到原因,还是英文网站靠谱些,具体查看
    <arel="nofollow">http://forums.terracotta.org/forums/posts/list/3927.page

    <divclass='ref'>

    引用来自“呼和浩特的白菜”的评论

    谢谢大家,我终于找到原因,还是英文网站靠谱些,具体查看
    <arel="nofollow">http://forums.terracotta.org/forums/posts/list/3927.page

    2020-06-08 10:21:18
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多