Hibernate框架使用中出现could not instantiate RegionFactory 异常的解决方法
2017-02-14 20:31
656 查看
二级缓存配置如下:
抛could not instantiate RegionFactory异常时本人引用的库
如果是缺少方框内的jar包导致的异常,没有时间后面的内容可以不看,后面内容主要分析出错原因。
重点在方框里
导入ehcache-2.10.3.jar包还抛如下异常
java.lang.NoClassDefFoundError:org/apache/commons/logging/LogFactory
表明缺少了commons-logging-1...jar包导入该jar包便不会抛出此异常了
如果还出现如下异常
则需再把backport-util-concurrent.jar包添加到构建路径便可以了
<!-- 指定要使用的缓存的提供商,打开二级缓存--> <property name="hibernate.cache.use_second_level_cache"> true </property> <property name="hibernate.cache.provider_class"> org.hibernate.cache.EhCacheProvider </property> <!-- 开启使用查询缓存 --> <property name="cache.use_query_cache">true</property>
如果使用了org.hibernate.cache.EhCacheProvider缓存相关的类请先检查项目所引用的库包含哪些jar包
要使用二级缓存所需要使用的库如下所示:抛could not instantiate RegionFactory异常时本人引用的库
如果是缺少方框内的jar包导致的异常,没有时间后面的内容可以不看,后面内容主要分析出错原因。
具体原因分析如下:
来看一下抛出的异常:重点在方框里
可以看出抛异常是因为缺少所需要的类,按照提示是缺少了跟异常有关的jar包,因此需要在构建路径里添加ehcache-2.10.3.jar
导入ehcache-2.10.3.jar包还抛如下异常
java.lang.NoClassDefFoundError:org/apache/commons/logging/LogFactory
表明缺少了commons-logging-1...jar包导入该jar包便不会抛出此异常了
如果还出现如下异常
则需再把backport-util-concurrent.jar包添加到构建路径便可以了
相关文章推荐
- 使用Oracle连接池错误 Cannot create PoolableConnectionFactory(Io 异常: The Network Adapter could not establish the connection )的解决方法
- php使用pdo操作数据库时出现ERROR:could not find driver的解决方法
- 使用hibernate出现could not parse configuration:hibernate.cfg.xml 错误的解决办法
- EJB项目出现“org.hibernate.LazyInitializationException: could not initialize proxy - no Session”异常解决
- org.hibernate.HibernateException: could not instantiate RegionFactory
- 使用getHibernateTemplate()的方法时出现空指针异常的解决办法
- org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.brid
- 关于在xcode中使用Versions时,比较文件出现The File Merge application could not be located. 解决方法
- 使用MySQL和Hibernate时,出现java.lang.UnsupportedOperationException: Update queries only supported through HQL异常的解决方法
- cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection问题解决方法(图文详解)
- could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridg
- 关于使用SSM整合的时候,使用hibernate校验框架出现500异常问题解决
- 使用Hibernate时出现“could not execute query”异常
- 使用ftp.storlines进行文件上传时出现553 Could not create file.的解决方法
- could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBrid
- Hibernate 使用时出现 Could not parse configuration: /hibernate.cfg.xml 的异常问题
- myeclipse 使用weblogic10启动hibernate项目时出现ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常的解决办法
- 关于在xcode中使用Versions时,比较文件出现The File Merge application could not be located. 解决方法
- Hibernate继承映射的“Could not format discriminator value to SQL string”错误解决方法
- org.hibernate.QueryException: could not resolve property错误的解决方法