Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Unable to connect to auth mongo (with replica set) from java application

$
0
0

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.


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>