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

JIRA | Randolph Tan | 4 years ago
  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 | 4 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 | 4 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

    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
  6. 0

    GeoSpatial Near Criteria Not working with radius [moved]

    GitHub | 4 years ago | jyemin
    com.mongodb.MongoException: invalid operator: $sphere

  1. sriharshakiran 2 times, last 7 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