Results 1 to 5 of 5

Thread: can't authenticate twice on same database

Threaded View

  1. #1
    Join Date
    Apr 2009
    Posts
    6

    Default can't authenticate twice on same database

    regarding mongodb

    Getting exception

    Code:
    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)
    when trying to authenticate to auth enabled mongodb

    related xml
    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>
    application is multi-threaded, with multiple threads all inserting to mongodb at once. The first couple of threads succeed, insert their rows, and terminate.

    Am I doing this wrong, is this a bug?
    Last edited by kochcp; Nov 30th, 2012 at 08:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •