国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

hibernate4.3.8整合struts2過程中遇到的問題

2019-11-14 23:37:39
字體:
來源:轉載
供稿:網友
hibernate4.3.8整合struts2過程中遇到的問題

1.遇到的異常:

Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:295)at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2444)at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2440)at org.hibernate.cfg.Configuration.buildsessionFactory(Configuration.java:1857)at com.ad.model.StudentTest.main(StudentTest.java:41)Caused by: org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.ehcache.EhCacheRegionFactory]at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:101)at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:46)at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)... 7 moreCaused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.cache.ehcache.EhCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:128)at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:87)... 10 more

原因如下:

1.原因在于hibernate4.0在hibernate.cfg.xml配置二級緩存和hibernate3.3有所不同,本例子用的是 Hibernate-core.4.3.6.Final,實際上從4.0開始就不一樣,二級緩存的配置對比如下所示:

4.0以上配置如下:

<PRoperty name="hibernate.cache.use_second_level_cache">true</property><property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>

3.3配置如下:

<property name="hibernate.cache.use_second_level_cache">true</property>

<propertyname="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>

2.hibernate需要導入的包:

  a。hibernate-release-4.3.8.Final/lib/required下面的所有包。

  b。hibernate-release-4.3.8.Final/lib/optional/ehcache下面的包。

  c。MySQL-connector-java-5.1.7-bin.jar

  d。slf4j-1.5.6中的slf4j-api-1.5.6.jar和slf4j-nop-1.5.6.jar


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 车险| 苍南县| 宣化县| 社会| 咸阳市| 通江县| 塔城市| 榆中县| 商城县| 维西| 高碑店市| 龙陵县| 沙田区| 炉霍县| 平凉市| 城固县| 灌阳县| 云安县| 黑山县| 宁晋县| 亚东县| 郴州市| 竹北市| 毕节市| 鄂伦春自治旗| 汉川市| 桐梓县| 九龙城区| 磴口县| 新和县| 绿春县| 鄱阳县| 蕲春县| 根河市| 晋州市| 小金县| 施甸县| 鄂伦春自治旗| 丹凤县| 商河县| 宣化县|