JFinal中使用Ehcache缓存属性查询报错

zlsj80 发布于 2016/11/11 22:36
阅读 453
收藏 0

@JFinal 你好,想跟你请教个问题:

请教大神一个问题,jfinal中我用Ehcache缓存一个List<Record>,然后在junit测试cache查询时报错:

net.sf.ehcache.config.InvalidConfigurationException: Search attributes not supported by this store type: net.sf.ehcache.store.disk.DiskStore

at net.sf.ehcache.store.AbstractStore.getSearchAttributes(AbstractStore.java:193)
at net.sf.ehcache.store.AbstractStore.getSearchAttribute(AbstractStore.java:184)
at net.sf.ehcache.store.CacheStore.getSearchAttribute(CacheStore.java:508)
at net.sf.ehcache.Cache.getSearchAttribute(Cache.java:3880)
at test_Unit.Test_cjztqk_stat.test(Test_cjztqk_stat.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

加载中
0
JFinal
JFinal
没配置缓存的 cache name 而已,在 ehcache.xml 中为相应的缓存配置一个 cache 
0
zlsj80
zlsj80

引用来自“JFinal”的评论

没配置缓存的 cache name 而已,在 ehcache.xml 中为相应的缓存配置一个 cache 

cache name已经有配置了,我发现只要设置了overflowToDisk="true" 这个属性,然后调用youCache.getSearchAttribute()就会报哪个异常net.sf.ehcache.config.InvalidConfigurationException: Search attributes not supported by this store type: net.sf.ehcache.store.disk.DiskStore

而且如果有多个cache,只要其中一个设置为 overflowToDisk="true",然后调用youCache.getSearchAttribute()都会报上面的异常

Ehcache居然不支持从磁盘缓存属性查找

返回顶部
顶部