regarding mongodb
Getting exception
when trying to authenticate to auth enabled mongodbCode:java.lang.IllegalStateException: can't authenticate twice on the same database at com.mongodb.DB.authenticate(DB.java:565) at org.springframework.data.mongodb.core.MongoDbUtils.doGetDB(MongoDbUtils.java:113) at org.springframework.data.mongodb.core.MongoDbUtils.getDB(MongoDbUtils.java:75)
related xml
application is multi-threaded, with multiple threads all inserting to mongodb at once. The first couple of threads succeed, insert their rows, and terminate.Code:<mongo:mongo id="mongodb" host="192.168.1.8" port="27017"> </mongo:mongo> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongodb"/> <constructor-arg name="databaseName" value="test-1"/> <constructor-arg name="userCredentials" ref="userCredentials"/> </bean> <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials"> <constructor-arg name="username" value="usm"/> <constructor-arg name="password" value="pwd"/> </bean>
Am I doing this wrong, is this a bug?


Reply With Quote