Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB (3.0.2) NullPointerException with Grails 2.4.3

I am trying to setup Grails web Application on EC2

InstanceType: m3 xlarge

installed JAVA from http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

version : java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

( as JAVA 8 is having issues : https://github.com/spring-projects/spring-loaded/issues/98 )

installed Grails from GVMtools

http://gvmtool.net/

grails version : 2.4.3

installed mongoDB from

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

with version MongoDB shell version: 3.0.2 connecting to: test

my DataSource.groovy config are :

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"
        } 
    }

my Buildconfig.groovy has latest mongo plugin:

compile ":mongodb:3.0.3"

but after starting the server

grails run-app

and opening any page i am getting this

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$1
|    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: I also tried creating user and authenticating it ( Grails - Connect to a MongoDB database using authentication )

with db.createUser.

What could be wrong with the configuration exact same configuration runs fine on my local machine.

like image 706
Ratan Kumar Avatar asked Apr 21 '15 17:04

Ratan Kumar


1 Answers

I created a instance with the same version and it works fine. Have you tried using grails clean and then run the app.

like image 179
allthenutsandbolts Avatar answered Nov 14 '22 23:11

allthenutsandbolts