gpt4 book ai didi

grails - 为 Grails 数据库迁移文件将 grails 升级到 2.5.0 时出现类未找到错误

转载 作者:行者123 更新时间:2023-12-01 11:33:26 25 4
gpt4 key购买 nike

我正在尝试将 Grails 应用程序从 2.4.3 版本升级到 2.5.0 版本。Grails 2.5.0 包含修复和改进,但没有任何重大更改。此外,还安装了所有 2.5.0 兼容的插件版本。

还查看了 Grails 数据库迁移插件变更日志和其他支持 grails 2.5.0 的插件。遇到我现在面临的相同 JIRA 问题 - Jira Link , 但它已在旧的 Grails 数据库迁移插件版本中修复。

BuildConfig.groovy

grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.reload.enabled = true
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6

grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
inherits("global") {
}
log "warn"
checksums true // Whether to verify checksums on resolve

repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/core" // Dependency for export plugin.
}
dependencies {
compile ("org.apache.jclouds.provider:cloudfiles-us:1.6.2-incubating", "org.jclouds:jclouds-compute:1.6.0") {
excludes "jclouds-core"
}
compile 'commons-beanutils:commons-beanutils:1.8.3'
compile "org.apache.jclouds:jclouds-core:1.7.2"
runtime 'mysql:mysql-connector-java:5.1.29'
}

plugins {
runtime ':database-migration:1.4.0'
runtime ":hibernate:3.6.10.18"
runtime ":jquery:1.11.0.2"
runtime ":resources:1.2.14"
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
build ":tomcat:7.0.55.2"
}
}

堆栈跟踪我在默认迁移位置 grails-app/migrations

有一个名为 upgrade-2.1.groovy 的迁移文件
| Error 2015-04-30 10:52:09,868 [localhost-startStop-1] ERROR 
context.GrailsContextLoaderListener - Error initializing the
application: Error creating bean with name 'grailsApplication'
defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is
org.codehaus.groovy.grails.exceptions.GrailsConfigurationException:
Class not found loading Grails application: upgrade-2.1
Message: Error creating bean with name 'grailsApplication' defined
in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is
org.codehaus.groovy.grails.exceptions.GrailsConfigurationException:
Class not found loading Grails application: upgrade-2.1

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 GrailsConfigurationException: Class not found loading Grails application: upgrade-2.1
->> 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 ClassNotFoundException: upgrade-2.1
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 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

最佳答案

这与插件或 Grails 无关 - 问题是 upgrade-2.1 不是 Groovy 脚本的有效名称。您只能使用有效类名的名称。您必须将句点替换为另一个字符,也可能是破折号。试试 upgrade_2_1.groovy

关于grails - 为 Grails 数据库迁移文件将 grails 升级到 2.5.0 时出现类未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29959680/

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