开发者社区> 问答> 正文

JFinal中使用Ehcache缓存是报错?报错

@JFinal 请教个关于Ehcache的问题: 

我用Ehcache缓存一个map,这个map数据量较大,有几千个key,发现Ehcache报一下的错误:


请教一下是什么原因,我已经把配置文件中缓存的对象配置的很大了,diskPersistent也设置为True了。

[2015-06-19 12:30:48,144]-[ERROR]-[system.data]-[net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask#call.488]: Disk Write of sensitive_word failed: 

java.lang.StackOverflowError: null

at java.io.ObjectOutputStream$BlockDataOutputStream.writeBlockHeader(ObjectOutputStream.java:1890) ~[na:1.8.0_25]

at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1875) ~[na:1.8.0_25]

at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1108) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_25]

at java.util.HashMap.internalWriteEntries(HashMap.java:1776) ~[na:1.8.0_25]

at java.util.HashMap.writeObject(HashMap.java:1354) ~[na:1.8.0_25]

at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]

at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]

at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_25]

at java.util.HashMap.internalWriteEntries(HashMap.java:1777) ~[na:1.8.0_25]

at java.util.HashMap.writeObject(HashMap.java:1354) ~[na:1.8.0_25]

at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) ~[na:na]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]

at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]

at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) ~[na:1.8.0_25]

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_25]


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

    检查一下是不是map中的对象有循环依赖,ehcache在缓存时进入了死循环,造成了  java.lang.StackOverflowError异常回复<aclass='referer'target='_blank'>@justFinal:可能是ehcache的bug,升级到新版本的ehcache试试已经找到问题了,是因为map中存的数据问题,有null的值和一个超长的字符串,改掉就好了。只是不知道为什么会出这个错误?<aclass='referer'target='_blank'>@JFinal

    2020-06-14 15:19:51
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

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