Reputation: 1003
Working with grails 3.1version, Getting this exception more often,mostly in production.
org.grails.datastore.mapping.core.ConnectionNotFoundException: No datastore session found. Call Datastore.connect(..) before calling Datastore.getCurrentSession()
at grails.mongodb.MongoEntity$Trait$Helper.getDboInternal(MongoEntity.groovy:128) ~[grails-datastore-gorm-mongodb-5.0.1.RELEASE.jar:na]
at grails.mongodb.MongoEntity$Trait$Helper.getAt(MongoEntity.groovy:118) ~[grails-datastore-gorm-mongodb-5.0.1.RELEASE.jar:na]
at grails.mongodb.MongoEntity$Trait$Helper.propertyMissing(MongoEntity.groovy:60) ~[grails-datastore-gorm-mongodb-5.0.1.RELEASE.jar:na]
at my.fanfest.framework.UserController.updatememe(UserController.groovy:1115) ~[classes/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_95]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_95]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_95]
Any assistance to solve this exception would help me a lot.
Upvotes: 0
Views: 686
Reputation: 2555
It's hard to help you without any specific code which causes a problem. You can use this workaround:
SomeDomain.withNewSession { session ->
// your code here
}
Upvotes: 1