com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'not authorized for query on whiplashreviewservice.company' on server <host>:<port>

Stack Overflow | Rahul Vijay | 1 year ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rp . Or join the community to write better ones.
  1. 0

    Dépassement de capacité de traitement MongoDb

    GitHub | 3 months ago | tjpb92
    com.mongodb.MongoQueryException: Query failed with error code 17144 and error message 'Plan executor error during find: Overflow sort stage buffered data usage of 33554647 bytes exceeds internal limit of 33554432 bytes' on server localhost:27017
  2. 0
    samebug tip
    Use replaceOne instead of updateOne
  3. 0

    I am trying to unlock a locked 3.x database. {code:java} public static void unlockMongoDB(MongoClient m) throws Exception { String context = "MongoDBHelper-unlockMongoDB: "; Logger.info(context + "Checking if MongoDB instance needs to be unlocked"); if(m.isLocked()) { Logger.info(context + "Unlocking MongoDB instance"); m.unlock(); } } {code} isLocked() fails with the following stack trace {noformat} 13 Jul 2015 02:20:20,893 ERROR ~ Prematurely reached end of stream 13 Jul 2015 02:20:20,894 ERROR ~ com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.connection.SocketStream.read(SocketStream.java:88) at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221) at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102) at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:416) at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:282) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:738) at com.mongodb.Mongo$2.execute(Mongo.java:725) at com.mongodb.DBCollection.findOne(DBCollection.java:737) at com.mongodb.DBCollection.findOne(DBCollection.java:710) at com.mongodb.DBCollection.findOne(DBCollection.java:657) at com.mongodb.DBCollection.findOne(DBCollection.java:646) at com.mongodb.Mongo.isLocked(Mongo.java:574) {noformat} Also I have noticed that if I pass the MongoClient object to another function and unlock it, the unlock appears to hang. If I use a try {} finally {} and unlock, it appears to go through.

    JIRA | 2 years ago | Dharshan Rangegowda
    com.mongodb.MongoSocketReadException: Prematurely reached end of stream
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I am trying to unlock a locked 3.x database. {code:java} public static void unlockMongoDB(MongoClient m) throws Exception { String context = "MongoDBHelper-unlockMongoDB: "; Logger.info(context + "Checking if MongoDB instance needs to be unlocked"); if(m.isLocked()) { Logger.info(context + "Unlocking MongoDB instance"); m.unlock(); } } {code} isLocked() fails with the following stack trace {noformat} 13 Jul 2015 02:20:20,893 ERROR ~ Prematurely reached end of stream 13 Jul 2015 02:20:20,894 ERROR ~ com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.connection.SocketStream.read(SocketStream.java:88) at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221) at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102) at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:416) at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:282) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:738) at com.mongodb.Mongo$2.execute(Mongo.java:725) at com.mongodb.DBCollection.findOne(DBCollection.java:737) at com.mongodb.DBCollection.findOne(DBCollection.java:710) at com.mongodb.DBCollection.findOne(DBCollection.java:657) at com.mongodb.DBCollection.findOne(DBCollection.java:646) at com.mongodb.Mongo.isLocked(Mongo.java:574) {noformat} Also I have noticed that if I pass the MongoClient object to another function and unlock it, the unlock appears to hang. If I use a try {} finally {} and unlock, it appears to go through.

    JIRA | 2 years ago | Dharshan Rangegowda
    com.mongodb.MongoSocketReadException: Prematurely reached end of stream

  1. rp 1 times, last 10 months ago
2 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.MongoQueryException

    Query failed with error code 13 and error message 'not authorized for query on whiplashreviewservice.company' on server <host>:<port>

    at com.mongodb.connection.ProtocolHelper.getQueryFailureException()
  2. MongoDB Java Driver
    DBCursor.hasNext
    1. com.mongodb.connection.ProtocolHelper.getQueryFailureException(ProtocolHelper.java:102)
    2. com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:303)
    3. com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:54)
    4. com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159)
    5. com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:260)
    6. com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:183)
    7. com.mongodb.operation.FindOperation$1.call(FindOperation.java:397)
    8. com.mongodb.operation.FindOperation$1.call(FindOperation.java:394)
    9. com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:196)
    10. com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:169)
    11. com.mongodb.operation.FindOperation.execute(FindOperation.java:394)
    12. com.mongodb.operation.FindOperation.execute(FindOperation.java:57)
    13. com.mongodb.Mongo.execute(Mongo.java:760)
    14. com.mongodb.Mongo$2.execute(Mongo.java:747)
    15. com.mongodb.DBCursor.initializeCursor(DBCursor.java:817)
    16. com.mongodb.DBCursor.hasNext(DBCursor.java:151)
    16 frames
  3. Spring Data MongoDB - Core
    MongoTemplate.findAll
    1. org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1882)
    2. org.springframework.data.mongodb.core.MongoTemplate.findAll(MongoTemplate.java:1300)
    3. org.springframework.data.mongodb.core.MongoTemplate.findAll(MongoTemplate.java:1296)
    3 frames
  4. com.whiplash.reviewer
    WriterController.printWelcome
    1. com.whiplash.reviewer.dao.WriterDaoImpl.createANewCompany(WriterDaoImpl.java:29)
    2. com.whiplash.reviewer.service.WriterServiceImpl.createANewCompany(WriterServiceImpl.java:20)
    3. com.whiplash.reviewer.controller.WriterController.printWelcome(WriterController.java:28)
    3 frames
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    4. java.lang.reflect.Method.invoke(Unknown Source)
    4 frames
  6. Spring
    InvocableHandlerMethod.invokeForRequest
    1. org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    2. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    2 frames
  7. Spring MVC
    FrameworkServlet.doGet
    1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)
    2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)
    3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)
    4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    8 frames
  8. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    1 frame
  9. Spring MVC
    FrameworkServlet.service
    1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    1 frame
  10. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    1 frame
  11. Glassfish Core
    ApplicationFilterChain.doFilter
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    2 frames
  12. Tomcat WS
    WsFilter.doFilter
    1. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    1 frame
  13. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    8. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    9. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    10. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    10 frames
  14. Grizzly HTTP
    JIoEndpoint$SocketProcessor.run
    1. org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    3. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    3 frames
  15. Java RT
    ThreadPoolExecutor$Worker.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    2 frames
  16. Tomcat Util
    TaskThread$WrappingRunnable.run
    1. org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    1 frame
  17. Java RT
    Thread.run
    1. java.lang.Thread.run(Unknown Source)
    1 frame