<!--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中運行,它拋出了「net/sf/ehcache/CacheException」。我也包括了hibernate-ehcache-4.1.1 jar。我甚至嘗試添加ehcache 2.8 jar。仍然每個添加都會添加到錯誤列表中。請幫幫我。無法爲hibernate 4.1.1配置EhCache,因爲它會拋出「net/sf/ehcache/CacheException」
堆棧跟蹤低於...
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)
產生的原因:在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader net.sf.ehcache.CacheException :拋出java.lang.ClassNotFoundException。 Java的:1714) 在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) 在java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) ...... 26多個 1月8日, 2014 3:40:07 PM org.apache.catalina.core.StandardContext startInternal SEVERE:Error listenerStart 2014年1月8日下午3時40分07秒org.apache.catalina.core.StandardContext startInternal
請發佈stacktrace。 –
在你部署的應用程序中的WEB-INF/lib中,你能看到'ehcache-core-2.4.3.jar'嗎? –
No Will Keeling .... – user3172418