Message MongoTimeoutException: timeout when connecting after 10,000 ms

I am using gorm in grails to connect to MongoDB. I get a MongoTimeOutException. I can successfully connect to MongoDb using the standalone mongo java driver program. Why can't I connect through the Grails GORM plugin?

Can anyone help? Below is the configuration

grails {
    mongo {
      host = "localhost"
      port = 27107
      databaseName = "test"
     options{
         connectionsPerHost=20
     }
    }
  }

Below is the domain class

class Device {


    String deviceType
    String deviceId
    int primary

    static constraints = {

    }
}

Below is the exception trace

| Error 2014-11-09 16:10:39,620 [http-bio-8080-exec-4] ERROR errors.GrailsExceptionResolver  - MongoTimeoutException occurred when processing request: [GET] /devices/Device

Timed out while waiting to connect after 10000 ms. Stacktrace follows:
Message: Timed out while waiting to connect after 10000 ms
    Line | Method
->>  131 | getDescription        in com.mongodb.BaseCluster
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    396 | getClusterDescription in com.mongodb.DBTCPConnector
|    569 | getType . . . . . . . in     ''
|    370 | isMongosConnection    in     ''
|    645 | isMongosConnection .  in com.mongodb.Mongo
|    454 | _check                in com.mongodb.DBCursor
|    546 | _hasNext . . . . . .  in     ''
|    571 | hasNext               in     ''
|   1893 | hasNext . . . . . . . in org.grails.datastore.mapping.mongo.query.MongoQuery$MongoResultList$1
|      8 | index                 in ewents.DeviceController
|    198 | doFilter . . . . . .  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter              in grails.plugin.cache.web.filter.AbstractFilter
|    895 | runTask . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
|    918 | run                   in     ''
^    695 | run . . . . . . . . . in java.lang.Thread

or can anyone share an example of Grails with GORM support? Mostly new to this Grails.

+4
source share
2 answers

I understood the question. This is my bad, given the port number 27107 instead of 27017, and I took a day to figure it out. Lol

+4

, , , . ( ...)

- com.mongodb.mongo.java "boolean isMongosConnection()" , .

+1

All Articles