apache / apache/grails-core

No gorm implementation configured for type [class org.grails.datastore.mapping.mongo.MongoDatastore$2]

Open
#14,408 3 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-data-mongodb
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Iam using grails 3.2.9 and gorm mongo version 6.1.2.

I am using descriminator mulitenant in my application.
Iam using two database connection in my application.There are syminvest1, syminvest2.I have authUser domain class, FinConfValues two domain classes. FinaConfValues has multitenantId.Here multitenant means authUserId.AuthUser collection is there in syminvest1,FinConfValues collection is there in syminvest2.
Steps to reproduces the error
When I access FinConfValues.list() it is throwing the exception.
No GORM implementation configured for type [class org.grails.datastore.mapping.mongo.MongoDatastore$2]. Ensure GORM has been initialized correctly. Stacktrace follows:
The domain classes are

AuthUser
```
class AuthUser implements Serializable {

private static final long serialVersionUID = 1

transient springSecurityService
ObjectId id
String username
String password
String firstname
String lastname
String email
String phoneno

boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired

AuthUser(String username, String password) {
this()
this.username = username
this.password = password
}

Set getAuthorities() {
AuthUserRole.findAllByAuthUser(this)*.role
}

def beforeInsert() {
encodePassword()
}

def beforeUpdate() {
if (isDirty('password')) {
encodePassword()
}
}

protected void encodePassword() {
password = springSecurityService?.passwordEncoder ? springSecurityService.encodePassword(password) : password
}

static transients = ['springSecurityService']

static constraints = {
username blank: false, unique: true
password blank: false
}

static mapping = {
password column: '`password`'
datasource 'syminvest1'

}
}
```

FinConfValues
```
class FinConfValues implements MultiTenant {
ObjectId id
ObjectId authUserId
String symbol
BigDecimal r
BigDecimal g
BigDecimal inflationRate
Integer nYears
Date reportingDate
BigDecimal revGrowthRate
static constraints = {
symbol(nullable:true)
r(nullable:true)
g(nullable:true)
inflationRate(nullable:true)
nYears(nullable:true)
reportingDate(nullable:true)
revGrowthRate(nullable:true)
authUserId(nullable:true)
}
static mapping = {
tenantId name:'authUserId'
collection 'finConfValues'
datasource 'syminvest2'
}
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the error with Grails 3.2.9 and GORM Mongo 6.1.2 using the AuthUser and FinConfValues domain classes, including the syminvest1 and syminvest2 datasource mappings. Start with the failing FinConfValues.list() call and the reported MongoDatastore implementation error; done means the cause is identified and the call no longer raises this exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, mongodb
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.