I have a wrapper class in java which communicates with mongo using mongo driver. I have introduced authentication in mongo, so if I am using using authentication on single instance my application is able to connect.
But If I am starting a replica set with the key file configuration and same user credentials my application encounters below exception -
com.mongodb.MongoException: unauthorized db:test lock type:0 client:localhost
Please note Replica set is started and running successfully. I tried to connect the database via mongo shell and fired below command , and it authenticated the user -
use test
db.auth("", "");
But my application in not able to connect. I am using Mongo driver 2.9.3.
Thanks in advance.