首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析类grails.plugin.multitenant.core.util.TenantUtils - Grails 2.3.11

无法解析类grails.plugin.multitenant.core.util.TenantUtils - Grails 2.3.11
EN

Stack Overflow用户
提问于 2018-09-28 20:28:07
回答 1查看 238关注 0票数 3

我在旧的grails中有一个项目,我试图将它升级到新版本的grails2.3.11,但是这个项目在导入多租户插件时出现了错误,这是一个错误的例子:

代码语言:javascript
复制
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
   ^

这是我的buildConfig:

代码语言:javascript
复制
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"
    }
}

有人知道如何解决这个错误吗?或者,我需要在buildconfig中修改什么来解决这个问题,也许是一个更新的插件?

编辑

似乎可行的解决方案是修改代码,使其与多租户-单db: 0.8.3兼容,然后接受导入,这将产生冲突,但我从代码中摘录了以下内容:

代码语言:javascript
复制
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())
             }
        }
    }
}

如何重写这一行TenantUtils.doWithTenant (1)

EN

回答 1

Stack Overflow用户

发布于 2018-10-04 08:58:15

D:\GitHub~\grails-app\conf\BootStrap.groovy: 3:无法解析类grails.plugin.multitenant.core.util.TenantUtils @第3行,第1列导入grails.plugin.multitenant.core.util.TenantUtils ^

您的代码使用TenantUtils类,它在multi-tenant-single-db:0.8.3 where中不可用,TenantUtils类在这个插件中在compile "org.grails.plugins:multi-tenant-core:1.0.3"中可用。

但是在研究了这个插件页面之后,它看起来像是“这个插件与Grails2.x不兼容,您可能想看看http://grails.org/plugin/multi-tenant-single-db。”

所以应该尝试compile "org.grails.plugins:multi-tenant-core:1.0.3"这个插件,或者根据multi-tenant-single-db:0.8.3这个插件文档修改代码。

希望这能帮到你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52562253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档