com.mongodb.MongoException: unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z

JIRA | Randolph Tan | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Copy and pasted from a user's comment on SERVER-6117: I tested it on v2.2.0-rc1 and could reproduce the error. Java code (using java-driver v2.8.0): {code} ArrayList<ServerAddress> servers = new ArrayList<ServerAddress>(); servers.add(new ServerAddress("s231", 20050)); servers.add(new ServerAddress("s231", 20051)); servers.add(new ServerAddress("s231", 20052)); Mongo m = new Mongo(servers); m.setReadPreference(ReadPreference.SECONDARY); final BasicDBObject query = new BasicDBObject(); final BasicDBObject fields = new BasicDBObject(); query.put("_id", new BasicDBObject("$gte", Integer.valueOf(1))); fields.put("_id", Long.valueOf(1)); final DB db = m.getDB("offerStore"); boolean ok = db.authenticate("user", "pw".toCharArray()); System.out.println("ok: " + ok); final DBCursor c = db.getCollection("offer").find(query, fields).limit(10); while(c.hasNext()) { DBObject offer = c.next(); System.out.println(offer); } c.close(); {code} Output after several runs: {code} ok: false Exception in thread "main" com.mongodb.MongoException: unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z at com.mongodb.MongoException.parse(MongoException.java:82) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:317) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:298) at com.mongodb.DBCursor._check(DBCursor.java:369) at com.mongodb.DBCursor._hasNext(DBCursor.java:492) at com.mongodb.DBCursor.hasNext(DBCursor.java:517) at de.idealo.offerstore.mongo.TempTest.authenticationTest(TempTest.java:507) at de.idealo.offerstore.mongo.TempTest.main(TempTest.java:716) {code}

    JIRA | 5 years ago | Randolph Tan
    com.mongodb.MongoException: unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z
  2. 0

    Copy and pasted from a user's comment on SERVER-6117: I tested it on v2.2.0-rc1 and could reproduce the error. Java code (using java-driver v2.8.0): {code} ArrayList<ServerAddress> servers = new ArrayList<ServerAddress>(); servers.add(new ServerAddress("s231", 20050)); servers.add(new ServerAddress("s231", 20051)); servers.add(new ServerAddress("s231", 20052)); Mongo m = new Mongo(servers); m.setReadPreference(ReadPreference.SECONDARY); final BasicDBObject query = new BasicDBObject(); final BasicDBObject fields = new BasicDBObject(); query.put("_id", new BasicDBObject("$gte", Integer.valueOf(1))); fields.put("_id", Long.valueOf(1)); final DB db = m.getDB("offerStore"); boolean ok = db.authenticate("user", "pw".toCharArray()); System.out.println("ok: " + ok); final DBCursor c = db.getCollection("offer").find(query, fields).limit(10); while(c.hasNext()) { DBObject offer = c.next(); System.out.println(offer); } c.close(); {code} Output after several runs: {code} ok: false Exception in thread "main" com.mongodb.MongoException: unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z at com.mongodb.MongoException.parse(MongoException.java:82) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:317) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:298) at com.mongodb.DBCursor._check(DBCursor.java:369) at com.mongodb.DBCursor._hasNext(DBCursor.java:492) at com.mongodb.DBCursor.hasNext(DBCursor.java:517) at de.idealo.offerstore.mongo.TempTest.authenticationTest(TempTest.java:507) at de.idealo.offerstore.mongo.TempTest.main(TempTest.java:716) {code}

    JIRA | 5 years ago | Randolph Tan
    com.mongodb.MongoException: unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z
  3. 0

    $all ArrayList problem with version 0.3-early-20121119-1140

    GitHub | 4 years ago | ihr
    com.mongodb.MongoException: $all requires array
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Data retrieval from mongodb java api

    Stack Overflow | 3 years ago | Jose Ramon
    com.mongodb.MongoException: interrupted at shutdown
  6. 0

    Lots of index failures throws error in Web UI

    GitHub | 3 years ago | jaxxstorm
    com.mongodb.MongoException: too much data for sort() with no index. add an index or specify a smaller limit

  1. sriharshakiran 2 times, last 10 months ago
5 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.mongodb.MongoException

    unauthorized db:offerStore ns:offerStore.offer lock type:0 client:192.x.y.z

    at com.mongodb.MongoException.parse()
  2. MongoDB Java Driver
    DBCursor.hasNext
    1. com.mongodb.MongoException.parse(MongoException.java:82)
    2. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:317)
    3. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:298)
    4. com.mongodb.DBCursor._check(DBCursor.java:369)
    5. com.mongodb.DBCursor._hasNext(DBCursor.java:492)
    6. com.mongodb.DBCursor.hasNext(DBCursor.java:517)
    6 frames
  3. de.idealo.offerstore
    TempTest.main
    1. de.idealo.offerstore.mongo.TempTest.authenticationTest(TempTest.java:507)
    2. de.idealo.offerstore.mongo.TempTest.main(TempTest.java:716)
    2 frames