hibernate -----Could not instantiate cache implementation异常处理
来源:互联网 发布:怎么看算法导论这本书 编辑:程序博客网 时间:2024/05/22 04:33
今天在使用Hibernate时,出现了Could not instantiate cache implementation的错误,我是在使用Hibernate tools时报的错误,应该运行时也会出现这样的错误,异常堆栈:
org.hibernate.HibernateException: Could not instantiate cache implementation
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64)
at org.hibernate.impl.SessionFactoryImpl.
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:357)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:88)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:352)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
at org.hibernate.cache.NoCacheProvider.buildCache(NoCacheProvider.java:21)
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61)
… 11 more
大概意思是二级缓存不可用,但是项目在开发阶段不需要启动缓存,所以就没有配置。
最后发现问题就是在这里,因为在Hibernate的bean的hbm配置文件中配置了缓存,而在hibernate的配置中没有配置提供的缓存机制,在早起的hibernate的早起版本中默认是提供ehcache的,但是在最近的版本中已经不提供默认配置了。所以必须自己手工配置。在 hibernate的配置中加入如下片段即可
- hibernate -----Could not instantiate cache implementation异常处理
- hibernate -----Could not instantiate cache implementation异常处理
- could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridg
- could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridg
- could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBrid
- org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.brid
- hibernate二级缓存报错could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCac
- hibernate-------could not instantiate id generator
- org.hibernate.HibernateException: could not instantiate RegionFactory
- Hibernate框架使用中出现could not instantiate RegionFactory 异常的解决方法
- iOS/Xcode异常:reason: ‘Could not instantiate class named NSLayoutConstraint’
- org.hibernate.MappingException: could not instantiate id generator
- Could not instantiate bean class [org.hibernate.cfg.Configuration]: Construct
- Hibernate 执行createSQLQuery报Could not instantiate resultclass错误
- org.hibernate.MappingException: could not instantiate id generator
- could not instantiate id generator
- Hibernate operation: could not insert异常
- hibernate.exception.SQLGrammarException异常:could not insert、
- 新手出道
- 硬盘安装了 Fedora 14 x86_64 [快速配置]
- 报到
- Mysql 快速插入批量数据,从文件中导入数据
- SIGCOMM 2010 论文 paper list
- hibernate -----Could not instantiate cache implementation异常处理
- 【转】printf("%f/n",5)的输出结果为什么是0.000000
- 并查集小记
- 正确进行 windows 程序部署
- ehcache集群缓存配置说明
- VBA基础
- poj 2452
- Iphone开发笔记--Custom UITableVIewCell
- Android Push Notification