MongoDB (3.0.2) Grails 2.4.3 出现 NullPointerException

MongoDB (3.0.2) NullPointerException with Grails 2.4.3

我正在尝试在 EC2 上设置 Grails Web 应用程序

实例类型:m3 xlarge

已从 http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

安装 JAVA

版本: java 版本“1.7.0_80” Java(TM) SE 运行环境(build 1.7.0_80-b15) Java HotSpot(TM) 64 位服务器 VM(构建 24.80-b11,混合模式)

(因为 JAVA 8 有问题:https://github.com/spring-projects/spring-loaded/issues/98

从 GVMtools 安装 Grails

http://gvmtool.net/

grails version : 2.4.3

已安装 mongo数据库来自

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

有版本 MongoDB shell 版本:3.0.2 连接到:测试

我的 DataSource.groovy 配置是:

environments {
    development {
        grails {
            mongo {
                host = "localhost"
                port = 27017
                username = "root"
                password = "root"
                databaseName = "someDatabase"
            }
        }
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        } 
    }

我的 Buildconfig.groovy 有最新的 mongo 插件:

compile ":mongodb:3.0.3"

但在启动服务器后

grails run-app

打开任何页面我都得到这个

Error:

Stacktrace follows:
Message: null
    Line | Method
->>  833 | executeQuery     in      org.grails.datastore.mapping.mongo.query.MongoQuery
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    542 | list             in org.grails.datastore.mapping.query.Query
|     49 | invokeQuery . .  in org.grails.datastore.gorm.finders.FindAllByFinder
|     43 | doInSession      in org.grails.datastore.gorm.finders.FindAllByFinder
|    302 | execute . . . .  in org.grails.datastore.mapping.core.DatastoreUtils
|     41 | execute          in org.grails.datastore.gorm.finders.AbstractFinder
|     40 | doInvokeInternal in org.grails.datastore.gorm.finders.FindAllByFinder
|    152 | invoke           in org.grails.datastore.gorm.finders.DynamicFinder
|    352 | invoke . . . . . in     ''
|    105 | methodMissing    in org.grails.datastore.gorm.GormStaticApi
|     32 | call . . . . . . in org.grails.datastore.gorm.internal.StaticMethodInvokingClosure
|     49 | function    in someDomain
|     25 | listAllResources in in.org.api.APIController
|     16 | index            in     ''
|    198 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter         in grails.plugin.cache.web.filter.AbstractFilter
|     53 | doFilter . . . . in   grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilte r
|     49 | doFilter         in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|     82 | doFilter . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|   1145 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
     745 | run              in java.lang.Thread

PS:我还尝试创建用户并对其进行身份验证 (Grails - Connect to a MongoDB database using authentication)

和db.createUser.

配置可能有什么问题完全相同的配置在我的本地机器上运行良好。

我创建了一个相同版本的实例,它工作正常。您是否尝试过使用 grails clean,然后 运行 应用程序。