My project is working fine. After I tried installing MongoDB plugin via Open grails plugin manager in GGTS IDE.
Now I am getting following error after running my project. Some info-- My MongoDB current version is v2.4.8. and I am installing this plugin. http://grails.org/plugin/mongodb .
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security Facebook ...
... finished configuring Spring Security Facebook
2014-01-22 01:28:16,788 [localhost-startStop-1] WARN hibernate.AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [com.lyfe.sec.Authority]; using defaults.
| Error 2014-01-22 01:28:18,524 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Database name must only contain letters, numbers, underscores and dashes!
Message: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Database name must only contain letters, numbers, underscores and dashes!
Line | Method
->> 109 | postProcessBeanFactory in org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . . . . . . . . in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run . . . . . . . . . in ''
^ 695 | run in java.lang.Thread
**Caused by IllegalArgumentException: Database name must only contain letters, numbers, underscores and dashes!**
->> 253 | createMongoTemplate in org.grails.datastore.mapping.mongo.MongoDatastore
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 222 | afterPropertiesSet in ''
| 53 | getObject . . . . . . in org.grails.datastore.gorm.mongo.bean.factory.MongoDatastoreFactoryBean
| 109 | postProcessBeanFactory in org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator
| 303 | innerRun . . . . . . . in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 695 | run . . . . . . . . . in java.lang.Thread
Of course, i think you would say Grails 2.4.0. Ok Here is my DataSource.groovy for mongodb:
environments {
development {
grails {
mongo {
host = "10.0.11.243"
port = 27017
username = "username"
password = "userpassword"
databaseName = "yourdb"
options {
autoConnectRetry = true
connectTimeout = 300
}
}
}
}
}
You must create a DB in mongo and a user that can access to it.
What name have you used for the database? Note the following line from the error:
Message: Error creating bean with name 'mongoDatastore':
FactoryBean threw exception on object creation; nested exception is
java.lang.IllegalArgumentException: **Database name** must only contain letters, numbers, underscores and dashes!
Somewhere in the config you've either entered an invalid database name or not set one at all. Check the values in DataSource.groovy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.