首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >grails多数据源无法运行应用程序

grails多数据源无法运行应用程序
EN

Stack Overflow用户
提问于 2017-04-25 16:50:29
回答 1查看 113关注 0票数 0

在grails 2.4.4和hibernate 3上尝试使用多数据源时,我遇到了麻烦。

一些研究建议升级到hibernate 4,但hibernate 3需要多租户单数据库。

看起来这个问题与ehCache有关: message error:

代码语言:javascript
复制
Error |
2017-04-25 08:46:00,889 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'transactionManager_paie' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_paie': Cannot resolve reference to bean 'sessionFactory_paie' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_paie': Invocation of init method failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'transactionManager_paie' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_paie': Cannot resolve reference to bean 'sessionFactory_paie' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_paie': Invocation of init method failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
    Line | Method
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'transactionManager_paie' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_paie': Cannot resolve reference to bean 'sessionFactory_paie' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_paie': Invocation of init method failed; nested exception is org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:

我的数据源:

代码语言:javascript
复制
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
    //cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
    //singleSession = true // configure OSIV singleSession mode
    naming_strategy = sn.rh.base.CustomNamingStrategy
    //cache.provider_class = 'net.sf.ehcache.hibernate.SingletonEhCacheProvider'
    }
environments {
    development{
      dataSource {
          dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
          driverClassName = "com.mysql.jdbc.Driver"
          dialect=org.hibernate.dialect.MySQL5InnoDBDialect
          url = "jdbc:mysql://localhost:3306/portailrh?autoreconnect=true"
          username = "user"
          password = "user"
          pooled = true

         // logSql = true
      }


      dataSource_paie { //Convention is dataSource_name

          dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
          driverClassName = "com.mysql.jdbc.Driver"
          url = "jdbc:mysql://localhost:3306/paie?autoreconnect=true"
          dialect=org.hibernate.dialect.MySQL5InnoDBDialect
          username = "user"
          password = "user"
         // pooled = true
      }
...

buidConfig的部分:

plugins { // plugins for the build system only build ":tomcat:7.0.55“//编译步骤的插件编译":scaffolding:2.1.2”compile ':cache:1.1.8‘compile ":asset-pipeline:1.9.9“//运行时需要插件但不需要编译//运行时":hibernate4:4.3.6.1”// or ":hibernate:3.6.10.18“运行时”:hibernate:3.6.10.19“//对于多租户运行时”:数据库迁移:1.4.0“运行时":jquery:1.11.1”//新的编译":i18n-templates:1.1.0.1“编译":ckeditor:4.4.1.0”//取消注释这些以启用额外的资产管道功能//编译":sass- asset-pipeline :1.9。0“//编译”:较少资产管道:1.10.0“//编译”:咖啡资产管道:1.8.0“//编译”:句柄栏资产管道:1.3.0.3“//安全编译"org.grails.plugins:spring-security-core:2.0.0”编译"org.grails.plugins:spring-security-ui:1.0-RC3“编译"org.grails.plugins:mail:1.0.7”

代码语言:javascript
复制
//multi societe0.9.0-SNAPSHOT"
compile "org.grails.plugins:multi-tenant-single-db:0.8.3"
//excel import
compile ":excel-import:2.0.0.BUILD-SNAPSHOT"
//audit log
compile "org.grails.plugins:audit-logging:1.1.1"
//test weceem
//compile ':weceem:1.4.1'
//compile ":weceem-spring-security:1.4"
//standalone
compile "org.grails.plugins:standalone:8.0.33"//8.0.33

//sms twilio
compile "org.grails.plugins:twilio:0.1"

//sms nexmo
compile "org.grails.plugins:nexmo:1.0"

}

你对此有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-04-25 19:11:35

最后,我成功地通过将我的hybernate降级到3.6.10.18来运行应用程序

但我正面临着一个新的错误,就在它启动时,它在登录时创建了一个类似于无限循环的东西

代码语言:javascript
复制
WARN  intercept.RequestmapFilterInvocationDefinition  - Exception initializing; this is ok if it's at startup and due to GORM not being initialized yet since the first web request will re-initialize. Error message is: null source

有没有办法解决这个问题?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43605860

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档