grails dbm生成gorm更改日志错误
我试图在grails中使用插件数据库迁移1.3.2,但每次运行命令grails dbm生成gorm更改日志错误,grails,database-migration,Grails,Database Migration,我试图在grails中使用插件数据库迁移1.3.2,但每次运行命令grails dbm generate gorm changelog changelog.groovy时,它都返回以下错误: | Packaging Grails application..... | Error Error executing script DbmGenerateGormChangelog: org.springframework.beans.factory.BeanCreationException: Erro
grails dbm generate gorm changelog changelog.groovy
时,它都返回以下错误:
| Packaging Grails application.....
| Error Error executing script DbmGenerateGormChangelog: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instanceTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.TagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? (Use --stacktrace to see the full trace)
应用程序可以完美地编译和运行,我使用的grails版本是2.2.4
我从.grails项目目录中删除了scriptCache目录
这是BuildConfig.groovy
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
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.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
legacyResolve false
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
mavenRepo "http://snapshots.repository.codehaus.org"
mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "https://oss.sonatype.org/content/repositories/snapshots/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
runtime 'postgresql:postgresql:8.4-701.jdbc3'
compile "org.grails:grails-core:2.2.2.BUILD-SNAPSHOT", { exclude "grails" }
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
}
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.2"
runtime ":resources:1.1.6"
compile ":webxml:1.4.1"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.4"
build ":tomcat:$grailsVersion"
runtime ":database-migration:1.3.2"
compile ':cache:1.0.0'
compile ":twitter-bootstrap:2.1.1"
compile ":functional-test:2.0.RC1"
test(":spock:0.7") {
exclude "spock-grails-support"
}
compile ":console:1.2"
compile ":spring-security-core:1.2.7.3"
compile ":quartz:1.0-RC8"
}
}
有人能指导我如何解决这个问题吗
谢谢。我自己解决了这个问题,我所做的是创建一个空项目,开始移动一些域文件、conf文件,并尝试测试命令是否运行,每次我更改一些文件时,我都会重新运行命令以确保项目仍然工作,最后我将注意力集中在UrlMappings.groovy上(在错误消息中,我提到了URL\u MAPPINGS\u HOLDER)文件,因为我以某种方式进行了更改,以便能够在映射之外获取grail应用程序(因为我正在动态生成URL) 错误映射如下所示
//workaround to the grailsApplication outside mapping see: http://jira.grails.org/browse/GRAILS-8508
def app
"500"(view:"/error") {
app = grailsApplication
}
我解决了从那里删除grailsApplication的问题,现在命令运行得很好。幸运的是,我们不再需要动态生成url。这个依赖项背后的意图是什么?
编译“org.grails:grails core:2.2.BUILD-SNAPSHOT”
这是为了避免grails中的Enum和inners类出现问题