net.sf.ehcache.CacheException异常解决的方法
1、出现net.sf.ehcache.CacheException: Error configuring from file:/D:/EclipseWorkspace2/hibernate_06_cache/bin/ehcache.xml错误的原因是ehcache.xml文件配置错误

2、由于上边的ehcache.xml文件不是最原始的文件,经过了多次的修改,在本次项目运行一些配置并不需要,所以解决办法是删除异常提示的错误的配置。Element <defaultCache> does not allow attribute "maxElementsOnDisk".意思是 <defaultCache> 下不允许设置maxElementOnDisk属性。删除即可。

3、最方便的建议网上下载一个ehcache.xml原始文件。这样的话需要的时候在设置。原始的defaultCache配置为:
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>

4、将ehcache.xml复制到工程的src目录下,运行程序即可解决异常。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:94
阅读量:159
阅读量:191
阅读量:174
阅读量:192