【发布时间】:2013-03-29 11:10:01
【问题描述】:
我也是新手,正在尝试创建一个简单的应用程序来推送到 heroku。我已经启动了应用程序并在我的本地主机上运行了一个在本地主机上运行的 mongo DB。我在 heroku 中的应用程序中添加了一个 mongo 数据库,但它不会在 heroku 上打开(应用程序不是数据库)。我不知道问题是什么,但我需要以某种方式将我的应用程序连接到 heroku 数据库吗?就像更改 database.properties 文件一样?我尝试通过获取此 URL 使用 heroku DB 在本地对其进行测试(我可以使用 mongoctl 很好地登录数据库):
mongodb://heroku_app10830648:************************@ds047387.mongolab.com:4738/heroku_app10830648
并将信息放入 database.properties 文件中:
#Updated at Wed Jan 09 19:16:49 MST 2013
#Wed Jan 09 19:16:49 MST 2013
mongo.database=heroku_app10830648
mongo.host=ds047387.mongolab.com
mongo.password=***********************
mongo.port=47387
mongo.username=heroku_app10830648
但是当我使用 mvn package 构建它时,我得到了这个错误:
T E S T S
结果:
测试错误: testCountAllNotebooks(com.xebia.shortnotes.domain.NotebookIntegrationTest):命令失败[命令失败[count] {“assertion”:“unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103”,“assertionCode” :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindAllNotebooks(com.xebia.shortnotes.domain.NotebookIntegrationTest):命令失败[命令失败[count] {“assertion”:“unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103”,“assertionCode” :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindNotebookEntries(com.xebia.shortnotes.domain.NotebookIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testSaveNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testDeleteNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testCountAllNotes(com.xebia.shortnotes.domain.NoteIntegrationTest):命令失败[命令失败[count] {“assertion”:“unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103”,“assertionCode” :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindNote(com.xebia.shortnotes.domain.NoteIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindAllNotes(com.xebia.shortnotes.domain.NoteIntegrationTest):命令失败[命令失败[count] {“assertion”:“未经授权的db:heroku_app10830648 ns:heroku_app10830648.note锁定类型:0客户端:71.208.224.103”,“assertionCode” :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testFindNoteEntries(com.xebia.shortnotes.domain.NoteIntegrationTest):命令失败[命令失败[count] {“assertion”:“未经授权的db:heroku_app10830648 ns:heroku_app10830648.note锁定类型:0客户端:71.208.224.103”,“assertionCode” :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testSaveNote(com.xebia.shortnotes.domain.NoteIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" :10057,“errmsg”:“db 断言失败”,“ok”:0.0} testDeleteNote(com.xebia.shortnotes.domain.NoteIntegrationTest): 命令失败 [命令失败 [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db 断言失败" , "ok" : 0.0}
测试运行:14,失败:0,错误:12,跳过:0
[信息] -------------------------------------------- ----------------------------------------
[错误] 构建失败
[信息] -------------------------------------------- ----------------------------------------
[INFO] 有测试失败。
如果有人能告诉我如何在 mvn 项目中使用除本地数据库之外的其他数据库,那么任何帮助将不胜感激。
【问题讨论】: