“在Grails 2.3数据库迁移中加载插件管理器:TomcatGrailsPlugin时出错”

时间:2013-09-15 21:12:14

标签: spring grails grails-plugin grails-2.0 database-migration

我使用Grails 2.3和Grails数据库迁移插件(1.3.6)。

当我做grails dbm-update时,我收到以下错误。我该如何解决这个错误?

 Error Error loading plugin manager: TomcatGrailsPlugin (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.ClassNotFoundException: TomcatGrailsPlugin
    at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:40)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at _GrailsBootstrap_groovy$_run_closure6.doCall(_GrailsBootstrap_groovy:64)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at _DatabaseMigrationCommon_groovy$_run_closure1.doCall(_DatabaseMigrationCommon_groovy:25)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at DbmUpdate$_run_closure1.doCall(DbmUpdate:23)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:591)
    at gant.Gant.executeTargets(Gant.groovy:590)
| Error Error loading plugin manager: TomcatGrailsPlugin

6 个答案:

答案 0 :(得分:11)

这是一个超级烦人的错误。我的应用程序依赖于使用run-script运行脚本,我得到了相同的行为。以下是我的解决方法:

plugins {
    ...
    // grails 2.3.2 and tomcat 7.0.42 cause scripts to not work :( Pass -DnoTomcat=true in the script args to fix this
    if (System.getProperty("noTomcat") == null) {
        build ":tomcat:7.0.42"
    }
}

然后在运行脚本时:

 grails -DnoTomcat=true run-script scripts/MyScript.groovy

肯定很烦人,但至少你可以在等待修复时使用所有其他最新功能。

答案 1 :(得分:5)

尝试更改buildConfig.groovy中的tomcat构建类型以编译而不是构建:

compile ':tomcat:7.0.42'

答案 2 :(得分:2)

因此,如果您发现这个因为您的脚本被2.3.x破坏了,那么我就会发现这个问题。我仍然无法使用run-script,因为它总是因为可怕的TomcatPlugin丢失问题而失败(我怀疑这意味着运行脚本总是试图无论如何都要尝试引导grails)。但是,我可以将脚本编译并作为任务运行。我的脚本总是会失败,因为我使用以下方法引导了grails:

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsBootstrap")
includeTargets << grailsScript("_GrailsClasspath")

target(main: "Generate a secret key to be used with HMAC and AES algorithms") {
   depends(bootstrap)  // this is problem
}

所有这些都来自那些说这样做的文档。但是,依赖(bootstrap)在2.3.x中被严重破坏,这是整个fork功能崩溃的一部分(是的,它没有经过深思熟虑)。

由于我很幸运,而且我的剧本不需要完全引导grails,我可以做以下事情并且它也能正常工作:

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsBootstrap")
includeTargets << grailsScript("_GrailsClasspath")

target(main: "Generate a secret key to be used with HMAC and AES algorithms") {
   depends(parseArguments)  // this is not problem
}

中提琴它又开始工作了。干得好。以下是有效的vs不起作用:

$ grails GenerateSecretKey              // yay works
$ grails run-script GenerateSecretKey   // doesn't work

以下是关于此问题的一些Jira问题,以便您知道所有这些都是错误的; - )

答案 3 :(得分:1)

我正在使用Grails 2.3.4,但这是我解决这个问题的方法:

  1. 升级到数据库迁移1.3.8
  2. 清除了我的scriptCache文件夹
  3. 执行刷新依赖
  4. 重新编写数据库迁移脚本,问题已解决。

答案 4 :(得分:0)

升级到2.3.2时遇到了同样的问题

我用标志-DnoTomcat

尝试了上面的内容

它仍然无法正常工作。然后我意识到有一些引用tomcat的inplace插件。这在某种程度上似乎是遗留的,因为带有grails 2.3.2的新创建的插件没有对tomcat的引用。所以我刚从插件中删除了所有引用,并在我的主应用程序中保留了标志开关。

答案 5 :(得分:0)

稍微澄清一下,上面提到的是chubbsondubs,但是我在第一次阅读时就错过了......

通常,对此的简单回答不是:

grails run-script scripts/DoSomething

这样做:

grails do-something