“Error loading plugin manager: TomcatGrailsPlugin” on Grails 2.3 Database Migration

后端 未结 6 2069
终归单人心
终归单人心 2020-12-13 23:29

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?



        
相关标签:
6条回答
  • 2020-12-13 23:35

    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.

    0 讨论(0)
  • 2020-12-13 23:38

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

    compile ':tomcat:7.0.42'

    0 讨论(0)
  • 2020-12-13 23:43

    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
    
    0 讨论(0)
  • 2020-12-13 23:53

    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 ;-)

    • http://jira.grails.org/browse/GRAILS-11216
    • http://jira.grails.org/browse/GRAILS-11219
    0 讨论(0)
  • 2020-12-13 23:55

    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.

    0 讨论(0)
  • 2020-12-13 23:55

    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.

    0 讨论(0)
提交回复
热议问题