我跟着這個guide與mongoDB建立一個gradle Springboot服務,然後跟着deployment instructions爲heroku。我還添加了mongoLab addOn。它在localhost上完美工作,但是當在heroku上達到數據庫部分時,響應無限期地停止。當我刪除mongoDB行並重新部署時,響應完美地工作。我如何使用mongoDB工作將此應用程序部署到heroku?如何在Gradle Springboot REST應用程序中連接heroku和mongodb?
編輯:這是錯誤的Heroku從日誌
org.mongodb.driver.cluster : No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
你可以分享你刪除的行,使應用程序工作? – codefinger
我完整地添加了項目。例如,在GameController中,在「/ create」端點上,當我刪除「database.save(board)」這一行時,它可以工作,但是當那一行出現時,它不起作用。 這在本地很好,但不適用於heroku – sicter