wfb*_*ale 3 mongodb salat mlab playframework-2.0
我正在尝试开始使用playframework中的salat插件.我已经配置了数据库application.conf并添加了所有依赖项Build.scala并将salat添加到play.plugins文件中.我还没有在项目中添加任何代码,我只是按照github页面上的说明操作,然后尝试运行该项目.我收到以下错误消息
(Server started, use Ctrl+D to stop and go back to the console...)
[info] play - mongodb [default] connected at heroku_app4620908@ds031907.mongolab.com:31907/heroku_app4620908
[error] application -
! @6bchnaacn - Internal server error, for request [GET /] ->
play.api.Configuration$$anon$1: Configuration error [couldn't connect to [ds031907.mongolab.com/107.21.153.211:31907]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:71) ~[play_2.9.1-2.0.3.jar:2.0.3]
at play.api.Configuration.reportError(Configuration.scala:258) ~[play_2.9.1-2.0.3.jar:2.0.3]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:105) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:98) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
Caused by: com.mongodb.CommandResult$CommandFailure: command failed [listDatabases]: { "serverUsed" : "db-uri" , "errmsg" : "need to login" , "ok" : 0.0}
at com.mongodb.CommandResult.getException(CommandResult.java:88) ~[mongo-java-driver-2.8.0.jar:na
at com.mongodb.CommandResult.throwOnError(CommandResult.java:134) ~[mongo-java-driver-2.8.0.jar:na]
at com.mongodb.Mongo.getDatabaseNames(Mongo.java:356) ~[mongo-java-driver-2.8.0.jar:na]
at com.mongodb.casbah.MongoConnection.getDatabaseNames(MongoConnection.scala:190) ~[casbah-core_2.9.1-2.4.1.jar:2.4.1]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:103) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:98) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
我很难过,因为我将我的密码和所有内容添加到conf文件中.从日志看起来好像无论是什么尝试连接到我的数据库,都没有先使用我提供的信息登录.
如你所说,看起来根本问题是MongoDB拒绝命令"listDatabases".此命令需要管理员访问 MongoDB进程,因为它显示有关其中托管的其他数据库的信息.
不幸的是,它返回的消息"需要登录",有点误导.你已经登录了!您只是没有列出数据库的权限.
这是一个简单的实验,你可以尝试使用MongoDB shell.看到"show dbs"失败并显示您在应用程序中收到的相同错误消息,但"show collections"(不需要访问您自己以外的任何其他数据库)是否成功?
% mongo ds031907.mongolab.com:31907/heroku_app4620908 -u heroku_app4620908 -p your_password
MongoDB shell version: 2.0.7
connecting to: ds031907.mongolab.com:31907/heroku_app4620908
> show dbs
Fri Aug 17 13:12:10 uncaught exception: listDatabases failed:{ "errmsg" : "need to login", "ok" : 0 }
> show collections
system.indexes
system.users
Run Code Online (Sandbox Code Playgroud)
(注意:我使用自己的MongoLab帐户进行了此操作,并在复制和粘贴时修改了文本,因此您可以将其复制到终端中.)
有没有办法避免使listDatabases调用?我不熟悉你正在使用的框架.
| 归档时间: |
|
| 查看次数: |
2195 次 |
| 最近记录: |