I indicate the cache providerlike this in the hibernate properites
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingDirectoryLocations" value="WEB-INF/mappings"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.mapping.precedence">class, hbm</prop>
</props>
</property>
</bean>
when i run tomcat i get this error:
2006-10-30 09:26:09,656 ERROR [org.springframework.web.context.ContextLoader]: C
ontext initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application
Context-hibernate.xml]: Invocation of init method failed; nested exception is or
g.hibernate.HibernateException: Could not instantiate cache implementation
Caused by:
org.hibernate.HibernateException: Could not instantiate cache implementation
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
214)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1218)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:807)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:740)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:348)
at org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
211)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:73
9)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
50)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
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:2
1)
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61)
... 42 more
2006-10-30 09:26:09,703 ERROR [org.apache.catalina.core.ContainerBase.[Catalina]
.[localhost].[/oms]]: Exception sending context initialized event to listener in
stance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application
Context-hibernate.xml]: Invocation of init method failed; nested exception is or
g.hibernate.HibernateException: Could not instantiate cache implementation
Caused by:
org.hibernate.HibernateException: Could not instantiate cache implementation
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
214)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1218)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:807)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:740)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:348)
at org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
211)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:73
9)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
50)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
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:2
1)
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61)
... 42 more
2006-10-30 09:26:09,750 ERROR [org.apache.catalina.core.ContainerBase.[Catalina]
.[localhost].[/oms]]: Exception sending context initialized event to listener in
stance of class org.acegisecurity.ui.session.HttpSessionEventPublisher
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application
Context-hibernate.xml]: Invocation of init method failed; nested exception is or
g.hibernate.HibernateException: Could not instantiate cache implementation
Caused by:
org.hibernate.HibernateException: Could not instantiate cache implementation
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
214)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1218)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:807)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:740)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:348)
at org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
211)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:73
9)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
50)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
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:2
1)
at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61)
... 42 more