gpt4 book ai didi

hibernate - 启用运行grails session 工厂

转载 作者:行者123 更新时间:2023-12-02 15:47:35 27 4
gpt4 key购买 nike

尝试与 Multi-Tenancy 在tomcat上发动 war 时出现错误

从日志文件:
由以下原因引起:org.springframework.beans.factory.BeanCreationException:创建名称为'sessionFactory'的bean时出错:调用init方法失败;嵌套的异常是org.hibernate.cache.NoCachingEnabledException:二级缓存未启用使用[hibernate.cache.use_second_level_cache | [hibernate.cache.use_query_cache]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)处
在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:302)
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
在org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
...更多42
原因:org.hibernate.cache.NoCachingEnabledException:二级缓存未启用使用情况[hibernate.cache.use_second_level_cache | [hibernate.cache.use_query_cache]
在grails.plugin.hibernatehijacker.hibernate.WrappedSessionFactoryBean.buildSessionFactory(WrappedSessionFactoryBean.java:45)

从我的数据源:

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

最佳答案

删除这些

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
}

并添加此
hibernate:
jdbc:
use_get_generated_keys: true

关于hibernate - 启用运行grails session 工厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44997772/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com