title: unauthorized db lock type:-1
body: <p>One of popular hosting in beta testing mode with MongoDB.</p>
  
  <p>Locally my application works fine. But after deployment in hosting I have the following problem:</p>
  
  <p>Tomcat:</p>
  
  <pre><code>    Jan 27, 2012 1:24:32 PM org.apache.catalina.core.ApplicationContext log 
  SEVERE: Exception while dispatching incoming RPC call 
  com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void ...' threw an unexpected exception: com.mongodb.MongoException: unauthorized db:mongodb-logger lock type:-1 client:192.168.23.159 
  at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
  at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
  at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
  at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
  at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
  at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:306)
  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
  at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1688)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
  at java.lang.Thread.run(Thread.java:722) 
  Caused by: com.mongodb.MongoException: unauthorized db:mongodb-logger lock type:-1 client:192.168.23.159 
  at com.mongodb.MongoException.parse(MongoException.java:82) 
  at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:312) 
  at com.mongodb.DBCursor._check(DBCursor.java:369) 
  at com.mongodb.DBCursor._hasNext(DBCursor.java:498) 
  at com.mongodb.DBCursor.hasNext(DBCursor.java:523) 
  at com.google.code.morphia.query.MorphiaIterator.hasNext(MorphiaIterator.java:40)
  at com.google.code.morphia.query.QueryImpl.asList(QueryImpl.java:234) 
  ... 
  ... 27 more
  
  Jan 27, 2012 1:24:32 PM org.apache.catalina.core.ApplicationContext log
  </code></pre>
  
  <p>Mongo:</p>
  
  <pre><code>Fri Jan 27 13:24:32 [initandlisten] connection accepted from 192.168.23.159:36649 #142 
  Fri Jan 27 13:24:32 [conn142] assertion 10057 unauthorized db:mongodb-logger lock type:-1 client:192.168.23.159 ns:mongodb-logger.....com.User query:{ login: "admin" }
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>       mongo = new Mongo(databaseHost, databasePort);
         db = mongo.getDB(databaseName);
         boolean auth = db.authenticate(databaseUser, databasePassword);
  </code></pre>
  
  <p>Works fine. auth = true.</p>
  
  <pre><code>    Morphia morphia = new Morphia();
      datastore = morphia.createDatastore(mongo, databaseHost);
  </code></pre>
  
  <p>Works fine too.</p>
  
  <p>Looks like problem occurs during first query. </p>
  
  <p>Any suggestions?</p>
  
  <p>PS: </p>
  
  <p>local db version: 2.0.2</p>
  
  <p>hosting db version: 1.8</p>
  
  <p><a href="https://jira.mongodb.org/browse/SERVER-2917" rel="nofollow">https://jira.mongodb.org/browse/SERVER-2917</a>  ?</p>