Reputation: 4297
I'm using Mongodb 4 with spring boot 2.1.0-M4
The follwing code works locally on my computer, but fails at dev environment:
@Transactional
public void registerNewUser(UserRegistrationForm registrationForm)
throws IllegalArgumentException {
validator.validate(registrationForm);
User user = new User();
user.setEmail(registrationForm.email);
user.setPassword(encoder.encode(registrationForm.password));
user.setEnabled(false);
user.setGroups(Sets.newHashSet(ClientRoles.USER));
User saved = userRepository.save(user);
registrationService.sendInvitation(user.getEmail());
}
With the following error:
com.mongodb.MongoCommandException: Command failed with error 40527 (Location40527): 'Unable to persist transaction state because the session transaction collection is missing. This indicates that the config.transactions collection has been manually deleted.' on server mongodb-1-servers-vm-0:27017. The full response is { "operationTime" : { "$timestamp" : { "t" : 1540422989, "i" : 1 } }, "ok" : 0.0, "errmsg" : "Unable to persist transaction state because the session transaction collection is missing. This indicates that the config.transactions collection has been manually deleted.", "code" : 40527, "codeName" : "Location40527", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1540422994, "i" : 1 } }, "signature" : { "hash" : { "$binary" : "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type" : "00" }, "keyId" : { "$numberLong" : "0" } } } } at
I have no idea what I should try debugging, or what to try, both databases are of the same version and have replica sets initialized. Any help is appreciated.
Upvotes: 1
Views: 587
Reputation: 4297
Actually, the error is pretty self explanatory. It seems that for some reason transactions
collection from dev environment db was deleted. The fix is straightforward:
use config
db.createCollection("transactions",{})
Upvotes: 2