<!--Cache Provider-->
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<!--The Query-level Cache-->
<property name="hibernate.cache.use_query_cache">true</property>
这些是我在hibernate.cfg.xml中定义的属性。当我在hibernate 3版本中使用类似的方式时它可以工作,但是在4.1.1 hibernate中它正在抛出&#34;净/ SF / ehcache的/ CacheException&#34 ;.我也包含了hibernate-ehcache-4.1.1 jar。我甚至尝试添加ehcache 2.8 jar。仍然每次添加都会增加错误列表。请帮帮我。
堆栈跟踪低于......
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getConstructor(Class.java:1657)
at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:386)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:251)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)
at com.gau.dbaccess.HibernateUtilities.<clinit>(HibernateUtilities.java:31)
at com.gau.dbaccess.ComponentsDetailsAccess.resetOnlinePsdLockAfterServerStart(ComponentsDetailsAccess.java:3503)
at com.gau.controller.ApplicationContextController.contextInitialized(ApplicationContextController.java:132)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
引起:java.lang.ClassNotFoundException:net.sf.ehcache.CacheException 在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) 在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) ......还有26个 2014年1月8日下午3:40:07 org.apache.catalina.core.StandardContext startInternal 严重:错误listenerStart 2014年1月8日下午3:40:07 org.apache.catalina.core.StandardContext startInternal
答案 0 :(得分:0)
可能你正在混合hibernate3和hibernate4的东西
删除所有旧的hibernate3代码和类;如果你使用spring org.springframework.orm.hibernate4.LocalSessionFactoryBean
(检查包,必须是hibernate4)