最近,我在一个 grails 项目中工作,并打算使用 mongodb 作为我们的 nosql 数据库,除了 mysql。
我添加了 mongodb 插件,使用域进行测试,它运行良好(显示/编辑/保存...):
compile ':mongodb:3.0.1'
并尝试使用 gmongo 插件的另一种方法,这在我想使用 mongodb 低级 API(或例如使用 mapReduce)的情况下很有用
runtime "org.mongodb:mongo-java-driver:2.11.3"
compile "org.mongodb:mongo-java-driver:2.11.3"
runtime "com.gmongo:gmongo:1.3"
尝试使用简单的查询 find() 进行测试,它也很有效
现在我想结合两种方法,这是错误:
| Error 2014-05-13 17:52:07,197 [localhost-startStop-1] ERROR plugins.DefaultGrailsPluginManager - Error configuring dynamic methods for plugin [mongodb:3.0.1]: com/mongodb/AggregationOptions
Message: com/mongodb/AggregationOptions
Line | Method
->> 2531 | privateGetDeclaredMethods in java.lang.Class
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1855 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 98 | createGormStaticApi . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 65 | configure in org.grails.datastore.gorm.plugin.support.DynamicMethodsConfigurer
| 49 | configure . . . . . . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 76 | doCall in MongodbGrailsPlugin$_closure2
| 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
Caused by ClassNotFoundException: com.mongodb.AggregationOptions
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 2531 | privateGetDeclaredMethods in java.lang.Class
| 1855 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 98 | createGormStaticApi . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 65 | configure in org.grails.datastore.gorm.plugin.support.DynamicMethodsConfigurer
| 49 | configure . . . . . . . . in org.grails.datastore.gorm.mongo.plugin.support.MongoMethodsConfigurer
| 76 | doCall in MongodbGrailsPlugin$_closure2
| 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
我真的不知道如何解决它!