无法使用mongo 3.0.2在2.4.4上运行grails run-app

时间:2014-11-06 09:55:54

标签: mongodb grails gorm

我已将grails升级到2.4.4并使用mongodb 3.0.2。

当我使用run-app命令触发应用程序时,它失败并出现以下异常:

| Error 2014-11-06 15:13:18,026 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
Message: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
    Line | Method
->>  131 | invokeMethod              in grails.spring.DynamicElementReader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    754 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
|    584 | beans . . . . . . . . . . in     ''
|    527 | invokeMethod              in     ''
|    262 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
|   1145 | runWorker                 in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run                       in java.lang.Thread

我尝试调试问题并发现,我在BuildConfig.groovy中添加了最新的gorm-release

compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
test 'org.grails:grails-datastore-simple:3.1.3.RELEASE'

当我从BuildConfig.groovy文件中删除这些依赖项时,app会正常运行。但我需要这些最新的依赖项。好吗?

2 个答案:

答案 0 :(得分:0)

得到了解决方案。问题在于 grails-datastore-gorm 依赖关系,它依赖于旧版本的 spring-beans

https://jira.grails.org/browse/GRAILS-11813

答案 1 :(得分:0)

使用spring 4.x bean版本的Grails 2.4.4。

当您的某些外部依赖项使用spring 3.X时会出现此问题 要找到添加spring 3.X jar在命令

下运行的依赖项

grails dependency-report

然后找到spring-beans-3.X jar 并在 Build.groovy 中排除此依赖关系,如下所示

编译com.sample.componenet.server.utilities:sample-logger:1.0.0            排除org.springframework:spring-beans:3.2.8.RELEASE

相关问题