0
votes

i've got error when trying to launch war on tomcat with multitenant

from logfiles: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 42 more 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 grails.plugin.hibernatehijacker.hibernate.WrappedSessionFactoryBean.buildSessionFactory(WrappedSessionFactoryBean.java:45)

from my datasources:

hibernate {
    cache.use_second_level_cache = true //true
    cache.use_query_cache = true //false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3

    //singleSession = true // configure OSIV singleSession mode
    naming_strategy = sn.kiyas.base.CustomNamingStrategy
    }

grails 2.4.4 apache-tomcat 7.0.79

1

1 Answers

0
votes

Remove these

hibernate {
    cache.use_second_level_cache = true //true
    cache.use_query_cache = true //false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3

    //singleSession = true // configure OSIV singleSession mode
    naming_strategy = sn.kiyas.base.CustomNamingStrategy
    }

And Add this

hibernate:
    jdbc:
        use_get_generated_keys: true