playMorphia 与 mongoLAB IllegalStateException:无法在同一 DBObject 上调用身份验证两次
我的游戏!应用程序有一个模块:吗啡。我的数据库是 mongolab (在 AWS 上)。它第一次编译并运行。然后将在所有后续请求中抛出此数据库验证异常。有谁知道 playmorphia 是否会尝试对每个请求重新进行身份验证?非常感谢任何帮助。谢谢。
Caused by: java.lang.IllegalStateException: can't call authenticate twice on the same DBObject
at com.mongodb.DB.authenticate(DB.java:437)
at play.modules.morphia.MorphiaPlugin.initMorphia_(MorphiaPlugin.java:368)
at play.modules.morphia.MorphiaPlugin.onApplicationStart(MorphiaPlugin.java:444)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:480)
at play.Play.start(Play.java:515)
My Play! application has one module, morphia. My DB is mongolab (on AWS). It compiles and runs the first time. Then will throw this DB authenticate exception an all subsequent requests. Does anyone know if playmorphia tries to re-authenticate on every request? Any help much appreciated. Thanks.
Caused by: java.lang.IllegalStateException: can't call authenticate twice on the same DBObject
at com.mongodb.DB.authenticate(DB.java:437)
at play.modules.morphia.MorphiaPlugin.initMorphia_(MorphiaPlugin.java:368)
at play.modules.morphia.MorphiaPlugin.onApplicationStart(MorphiaPlugin.java:444)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:480)
at play.Play.start(Play.java:515)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,数据库身份验证在游戏开始时调用。问题是,当您在开发模式下运行时,游戏可能会在 java 源代码和查看源代码中的每次代码更改时重新启动。
我以前从未遇到过这个问题,因为我总是在 可信环境。但这种问题应该避免,可能只是简单地尝试/捕获并忽略。您能否将问题提交到 https://github.com/greenlaw110/play-morphia/问题/新?
Well, db authentication is called on play start. The problem is when you are run in dev mode, play might restart on every code change in your java source and view source.
I've never encountered this problem before coz I've always using mongodb in a trusted environment. But this kind of issue should be avoid, probably simply try/catch and ignore. Could you please submit an issue to https://github.com/greenlaw110/play-morphia/issues/new ?
这个“验证两次异常”是
在类 DatastoreImpl 的构造函数中使用 user&pass 调用时抛出的。
因此,如果您在同一个数据库中 new DatastoreImpl() 两次,则会发生此异常。
您可以尝试下面的代码,希望它有帮助:
this "auth twice exception" is thrown at
it's called in class DatastoreImpl's constructor with user&pass .
so, if you new DatastoreImpl() at same db twice, this exception will occour.
you can try code below, hope it helps: