"Error loading plugin manager: TomcatGrailsPlugin" on Grails 2.3 Database Migration
Asked Answered
S

6

8

I use Grails 2.3 and the Grails database migration plugin (1.3.6).

When I do grails dbm-update I get the following error. How can I solve this error?

 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
Soundboard answered 15/9, 2013 at 21:12 Comment(4)
Recently a defect has been logged for the same.Whenever
@Whenever do you have an idea how to solve this issue?Soundboard
@confile Am facing the same problem in grails 2.3 with db-migration plugin 1.3.5Denary
Tested in 2.3.7 and still gives this error.Applewhite
A
11

This is a super annoying bug. My application depends on running scripts with run-script and I get the same behavior. Here's what I did as a workaround:

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"
    }
}

Then when running your script:

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

Annoying for sure, but at least you can use all the other latest features while awaiting a fix.

Archie answered 18/11, 2013 at 2:10 Comment(3)
I never could get run-script to work with this method. If I did a grails compile, then grails MyScript it worked using this method. If I used run-script it bombed with a MissingPropertyException includeTargets.Rozalin
I tested with 2.3.7 and this work-around is working.Applewhite
Hi, I'm finding the same issue. Do you know if anyone has already rised a bug for this? CheersVanover
W
5

Try change the tomcat build type in buildConfig.groovy to compile instead of build:

compile ':tomcat:7.0.42'

Wore answered 20/10, 2013 at 21:22 Comment(0)
R
2

So if you are finding this because your scripts are broken by 2.3.x here is what I discovered about the problem in general. I still can't use run-script because it always fails with the dreaded TomcatPlugin missing problem (I suspect this means run-script is always trying to bootstrap grails irregardless). However, I can get the scripts to compile and run as tasks. My scripts would always fail because I had bootstrapped grails using the following method:

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
}

All of that is from the docs that say to do that. However, depends(bootstrap) is broken badly in 2.3.x which is apart of the whole fork feature debacle (yes it was not well thought out).

Since I got so lucky and my scripts don't really have to fully bootstrap grails I could do the following and it worked just as well:

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
}

And viola it started working again. Well working-ish. Here is what works vs doesn't work:

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

Here are some Jira issues about this problem(s) so you'll know when all of this is wrong ;-)

Rozalin answered 18/3, 2014 at 16:9 Comment(0)
P
1

I'm on Grails 2.3.4, but here's how I fixed this problem:

  1. Upgraded to database migration 1.3.8
  2. Cleared my scriptCache folder
  3. Executed refresh-dependencies

Retried the database migration script, and the problem was resolved.

Pangenesis answered 9/12, 2013 at 3:23 Comment(0)
D
0

I had the same issue when upgrading to 2.3.2

I tried the above with the flag -DnoTomcat

It was still not working. Then I realised having some inplace plugins referencing tomcat as well. This seems to be legacy in some way, because freshly created plugins with grails 2.3.2 dont have references to tomcat. So I just removed all references from the plugins and kept the flag switch in my main application.

Dossier answered 20/11, 2013 at 11:57 Comment(0)
M
0

Just a slight clarification, which was mentioned aboveby chubbsondubs, but which I missed on first read...

Usually the simple answer to this is instead of doing:

grails run-script scripts/DoSomething

just do this:

grails do-something
Monarchism answered 28/10, 2014 at 15:47 Comment(3)
I believe this was flagged for being a duplicate of an existing answer already on this question... not sure how we're supposed to handle this, but I recommended deletion.Tenacious
Sorry to clarify -- In my case I did NOT need to do anything but the above step in order to fix the problem.Monarchism
A better (more complete) answer is at #23746417Monarchism

© 2022 - 2024 — McMap. All rights reserved.