gpt4 book ai didi

grails - Grails dbm-update中的异常-NoSuchBeanDefinitionException

转载 作者:行者123 更新时间:2023-12-02 15:26:44 37 4
gpt4 key购买 nike

当我运行"grails dbm-update --dataSource=production"时,出现以下异常:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory_production' is defined
at grails.plugin.databasemigration.MigrationUtils.findSessionFactory(MigrationUtils.groovy:142)
at grails.plugin.databasemigration.MigrationUtils.getDatabase(MigrationUtils.groovy:105)
at _DatabaseMigrationCommon_groovy$_run_closure2_closure11.doCall(_DatabaseMigrationCommon_groovy:52)
at grails.plugin.databasemigration.MigrationUtils.executeInSession(MigrationUtils.groovy:133)
at _DatabaseMigrationCommon_groovy$_run_closure2.doCall(_DatabaseMigrationCommon_groovy:51)
at DbmUpdate$_run_closure1.doCall(DbmUpdate:25)

它适用于默认数据源(如果我运行“grails dbm-update”),但不适用于生产或自定义数据源。

我使用Grails 2.4.3和database-migration:1.4.0。
我正在Amazon AWS-RDS MySql DB上运行它。

这是我的数据源:
production {        
grails.dbconsole.enabled = true
dataSource {
grails.dbconsole.enabled = true
username = "myusername"
password = "mypassword"
pooled = true
dbCreate = "none"
driverClassName = "com.mysql.jdbc.Driver"
url = "jdbc:mysql://mydatabase.us-west-1.rds.amazonaws.com:3306/ebdb?autoReconnect=true" dialect = org.hibernate.dialect.MySQL5InnoDBDialect
properties {
validationQuery = "SELECT 1"
testOnBorrow = true
testOnReturn = true
testWhileIdle = true
timeBetweenEvictionRunsMillis = 1800000
numTestsPerEvictionRun = 3
minEvictableIdleTimeMillis = 1800000
}
}
}

最佳答案

您称为production的项目不是数据源,而是production环境中常规dataSource的配置。因此,此调用应该有效:

grails prod dbm-update

关于grails - Grails dbm-update中的异常-NoSuchBeanDefinitionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26414906/

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