'Getting error when upgrading mongo java driver to 4.4
I am upgrading the mongo java driver from 3.11.1 to 4.4.1.
Seems like spring data mongo also needs to be upgraded, so I am going from 2.2.0.RELEASE to 3.0.0.RELEASE. If I didn’t upgrade the spring data mongo, then it is a problem because version 2.2.0 includes mongo java driver 3.X, which hinders the overall upgrade of the mongo java driver upgrade to 4.4.1.
My spring data commons was at 2.2.0.RELEASE.
Mongo client (that worked before):
++++++++++
<mongo:mongo-client id=“mongoClient” host="${mongo.host}" port="${mongo.port}" replica-set="${mongo.replica.set}"
credentials="${mongo.username}:#{mongoCredentials.password}@${mongo.dbname}">
<mongo:client-options connections-per-host="${mongo.connections.per.host}"
threads-allowed-to-block-for-connection-multiplier=“4”
connect-timeout="${mongo.connection.timeout}" max-wait-time="${mongo.max.wait.time}"
socket-keep-alive=“true” socket-timeout=“1500” ssl="${mongo.ssl}" />
</mongo:mongo-client>
++++++++++
When I deploy the app, I am getting this error. Never got it with the old configuration.
++++++++++
Caused by: com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'there are no users authenticated' on server 127.0.0.1:27017
at com.mongodb.internal.operation.FindOperation.lambda$execute$1(FindOperation.java:670)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$2(OperationHelper.java:564)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$3(OperationHelper.java:563)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.withSourceAndConnection(OperationHelper.java:562)
at com.mongodb.internal.operation.FindOperation.lambda$execute$2(FindOperation.java:661)
at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:65)
at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:692)
at com.mongodb.internal.operation.FindOperation.execute(FindOperation.java:86)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:191)
at com.mongodb.client.internal.FindIterableImpl.first(FindIterableImpl.java:200)
at org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:2906)
at org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:2877)
at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2735)
++++++++++
If I make the following changes, eventually I get back to the same error as above:
Spring data mongo: 3.3.0 (instead of 2.2.0.RELEASE to 3.0.0.RELEASE, trying 3.3.0)
Spring data commons: 2.2.0.RELEASE to 2.5.0
Spring framework: From 5.2.1.RELEASE to 5.3.4
EDIT:
I updated my local mongo server to 4.4. I'm still getting the same error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
