广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    net.sf.ehcache.CacheException异常解决的方法

    来源:网络收集  点击:  时间:2024-05-22
    【导读】:
    下午学习hibernate的时候出现如下的异常:%%%% Error Creating SessionFactory %%%%net.sf.ehcache.CacheException: Error configuring from file:/D:/EclipseWorkspace2/hibernate_06_cache/bin/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was null:42: Element defaultCache does not allow attribute maxElementsOnDisk.最后查出原因并不是因为在ehcache.xml下的默认缓存设置下出现错误的设置。工具/原料morehibernate缓存机制方法/步骤1/4分步阅读

    出现net.sf.ehcache.CacheException: Error configuring from file:/D:/EclipseWorkspace2/hibernate_06_cache/bin/ehcache.xml错误的原因是ehcache.xml文件配置错误

    2/4

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

    3/4

    最方便的建议网上下载一个ehcache.xml原始文件。这样的话需要的时候在设置。原始的defaultCache配置为:

    defaultCache

    maxElementsInMemory=10000

    eternal=false

    timeToIdleSeconds=120

    timeToLiveSeconds=120

    overflowToDisk=true

    /

    4/4

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

    NetBeans
    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_828359.html

    相关资讯

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号05-05 02:41:28  耗时:0.033
    0.0333s