简体   繁体   中英

Unable to resolve class grails.plugin.multitenant.core.util.TenantUtils - Grails 2.3.11

I have a project in the old grails, and I'm trying to upgrade it to the new version of grails 2.3.11, but this one giving error with the import for the mult tenant plugin, this is an example of an error:

D:\GitHub\~\grails-app\conf\BootStrap.groovy: 3: unable to
 resolve class grails.plugin.multitenant.core.util.TenantUtils
 @ line 3, column 1.
   import grails.plugin.multitenant.core.util.TenantUtils
   ^

This is my buildConfig:

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment to disable ehcache
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    repositories {
        grailsPlugins()
        grailsHome()
        grailsCentral()

        // uncomment the below to enable remote dependency resolution
        // from public Maven repositories
        mavenLocal()
        mavenCentral()
        //mavenRepo "http://snapshots.repository.codehaus.org"
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        //mavenRepo "http://repository.jboss.com/maven2/"
    }
    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.13'
        // https://mvnrepository.com/artifact/org.gagravarr/vorbis-java-core
        compile group: 'org.gagravarr', name: 'vorbis-java-core', version: '0.8'

    }
    plugins {
        //build ":tomcat:7.0.52.1"
        build ":tomcat:7.0.70"
        runtime ":hibernate:3.6.10.9"

        compile ':scaffolding:2.0.3'

        runtime ":jquery:1.8.3"
        compile ':cache:1.1.1'

        runtime ':resources:1.2.8'

        compile ":cache-headers:1.1.5"
        runtime ":cached-resources:1.0"
        runtime ":zipped-resources:1.0"
        runtime ":yui-minify-resources:0.1.5"

        // framework dependencies
        compile ":mail:1.0.1"
        compile ":fields:1.4"
        compile ":runtime-logging:0.4"
        compile ":burning-image:0.5.1"
        compile ":twitter-bootstrap:2.3.2"
        compile ":spring-security-core:2.0-RC4"
        compile ":spring-security-rest:1.4.0.RC5"/*, {
            excludes: 'spring-security-core'
        }*/

        // events to implement app hooks
        compile ":platform-core:1.0.RC6"

        // Para fazer upload de imagens
        compile ":attachmentable:0.3.0"

        // calendários para campos do tipo Date
        compile ":calendar:1.2.1"

        // exportar dados para Excel
        compile ":excel-export:0.1.9", {
            excludes: 'xerces'
        }

        // Jasper Reports
        compile ":jasper:1.11.0"

        // Export CSV
        compile ":csv:0.3.1"

        // Tests
        test ":cucumber:0.6.2"

        // Profiling
        compile ":profiler:0.5"

        //webservice SOAP
        compile ":cxf:1.1.4"
        compile ":cxf-client:2.0.3"

        //cron job
        compile ":quartz:1.0.2"

        compile ":ws-client:1.0"
        compile ":multi-tenant-single-db:0.8.3"

        //compile ":falcone-util:1.0"
    }
}

Does anyone know how to solve this error? Or what do I have to change in my buildconfig to solve, maybe a newer plugin?

EDIT

The solution that seems plausible is to change my code to be compatible with multi-tenant-single-db: 0.8.3, then taking the import, which is generating the conflict, but I have the following excerpt from the code:

class AssetController extends coss.BaseController {
  def restCreate = {
     TenantUtils.doWithTenant(1) {
            try {
                def json = JSON.parse(text)
                Asset asset = new Asset()
                ...
             } catch (Exception e) {
                log.error (e)
                render(status:500, text:e.getMessage())
             }
        }
    }
}

How do I override this line TenantUtils.doWithTenant (1) ?

D:\\GitHub\\~\\grails-app\\conf\\BootStrap.groovy: 3: unable to resolve class grails.plugin.multitenant.core.util.TenantUtils @ line 3, column 1. import grails.plugin.multitenant.core.util.TenantUtils
^

Your code uses TenantUtils class which not available in multi-tenant-single-db:0.8.3 where, TenantUtils class available in compile "org.grails.plugins:multi-tenant-core:1.0.3" in this plugin.

But after exploring this plugin page , it looks like " This plugin is not compatible with Grails 2.x. You may want to have a look at http://grails.org/plugin/multi-tenant-single-db . "

So should try compile "org.grails.plugins:multi-tenant-core:1.0.3" this plugin or change your code according multi-tenant-single-db:0.8.3 this plugin documentation .

Hope this will helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM