未经授权的数据库锁定类型:-1
MongoDB Beta 测试模式下流行的托管之一。
在本地,我的应用程序运行良好。但是在托管中部署后,我遇到以下问题:
Tomcat:
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
Mongo:
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" }
代码:
mongo = new Mongo(databaseHost, databasePort);
db = mongo.getDB(databaseName);
boolean auth = db.authenticate(databaseUser, databasePassword);
工作正常。授权=真。
Morphia morphia = new Morphia();
datastore = morphia.createDatastore(mongo, databaseHost);
效果也很好。
看起来第一次查询时出现了问题。
有什么建议吗?
PS:
本地数据库版本:2.0.2
托管数据库版本:1.8
One of popular hosting in beta testing mode with MongoDB.
Locally my application works fine. But after deployment in hosting I have the following problem:
Tomcat:
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
Mongo:
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:
mongo = new Mongo(databaseHost, databasePort);
db = mongo.getDB(databaseName);
boolean auth = db.authenticate(databaseUser, databasePassword);
Works fine. auth = true.
Morphia morphia = new Morphia();
datastore = morphia.createDatastore(mongo, databaseHost);
Works fine too.
Looks like problem occurs during first query.
Any suggestions?
PS:
local db version: 2.0.2
hosting db version: 1.8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我写了一个简单的重现,但成功运行它没有任何问题。
结果是:
这似乎是正确的事情。您可以运行此代码,但替换您的数据库/用户/密码吗?
I wrote a simple repro but didn't have any problem running it successfully.
Which resulted in this:
Which seems like the correct thing. Can you run this code, but substitute your db/user/password?
我在 Mongolab 上遇到了同样的问题。
org.springframework.data.mongodb.UncategorizedMongoDbException:未经授权的数据库:培根锁类型:-1客户端:YYY;嵌套异常是 com.mongodb.MongoException: 未经授权的 db:bacon 锁类型:-1 client:YYY
org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:70)
org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1538)
如果是本地的,则可能是 PC、路由器或电缆提供商上的防火墙问题。
已修复 对我来说,McAfee Host Intrusion Prevention (McAfeeFire.exe) 需要 STS.exe 和 Java 的规则才能访问 Mongolab 等远程主机。成功了!
I am getting the same issue with Mongolab.
org.springframework.data.mongodb.UncategorizedMongoDbException: unauthorized db:bacon lock type:-1 client:YYY; nested exception is com.mongodb.MongoException: unauthorized db:bacon lock type:-1 client:YYY
org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:70)
org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1538)
If it's local it could be firewall issue on the PC, Router or Cable provider.
FIXED For me, McAfee Host Intrusion Prevention (McAfeeFire.exe) required a rule for STS.exe and Java to be able to access remote hosts like Mongolab. That worked!