【问题标题】:Grails 2.5.0 + mongo + hibernateGrails 2.5.0 + mongo + 休眠
【发布时间】:2016-02-22 22:42:26
【问题描述】:

我正在尝试通过 mongo 驱动程序使用休眠并遇到一些问题:

我使用 grails 2.5.0 创建了全新的 grails 应用程序。将 dataSource.groovy 更改为指向 mysql,取消注释 mysql-connector-java:5.1.29,一切正常。

但是当我将 compile "org.grails.plugins:mongodb:5.0.0.RC1" 添加到 Build Config 的插件部分时,我会在启动时得到这个:

| Error 2016-02-22 14:32:29,439 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.evaluateMapping

我错过了什么?

注意!应用无法启动,因此此时所有内部映射都无关紧要。

这是我的配置文件:

数据源 -> https://cldup.com/GnXUJDOy0b.txt

BuildConfig ->https://cldup.com/xtk5l1F_BW.txt

错误 -> https://cldup.com/NJ7vpoX3Kb.txt

【问题讨论】:

    标签: mysql mongodb hibernate grails


    【解决方案1】:

    如果您显示更多代码但似乎您没有在域类定义中设置 mongo 的映射,这可能会很有用:

    static mapWith="mongo"
    

    Here你可以找到一个有用的教程

    【讨论】:

      【解决方案2】:

      经过几天的搜索找到了这个答案,我找不到让 mongodb 5.0.1 工作的方法。这个解决方案奏效了。

      plugins {
          compile (":mongodb:3.0.2") {
              excludes 'grails-datastore-gorm-plugin-support'
              excludes 'grails-datastore-gorm'
              excludes 'grails-datastore-core'
          }
      }
      

      然后在依赖项中,将正确的拉入:

      dependencies {
          compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.3.RELEASE'
          compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
          compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
      }
      

      从这里Cannot install Grails MongoDB plugin

      希望这会为某人节省大量时间和精力。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-03-31
        • 1970-01-01
        • 1970-01-01
        • 2013-03-11
        • 2014-01-14
        • 1970-01-01
        相关资源
        最近更新 更多