2016-02-25 22 views
1

我正在使用scala介紹heroku。在我應該在本地運行應用程序的品脫(link)我得到以下錯誤。使用scala示例在本地運行heroku時出錯

PS E:\heroku_test\scala-getting-started> heroku local web -f Procfile.windows 
forego | starting web.1 on port 5000 
web.1 | [warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configur 
ation file instead. 
web.1 | [info] application - Creating Pool for datasource 'default' 
web.1 | [error] c.z.h.HikariConfig - when specifying driverClassName, jdbcUrl must also be specified 
web.1 | Oops, cannot start the server. 








web.1 | Configuration error: Configuration error[Cannot connect to database [default]] 
web.1 | Factory.java:62) 
web.1 | stMethod.java:53) 
web.1 | at com.google.inject.Guice.createInjector(Guice.java:96) 
web.1 | a:199) 

我懷疑這是非常簡單的東西,但我找不到在谷歌的錯誤信息。此外,教程中的所有前面的步驟都完全按照預期進行。

編輯: 從application.conf

# Database configuration 
# ~~~~~ 
# You can declare as many datasources as you want. 
# By convention, the default datasource is named `default` 
# 
# db.default.driver=org.h2.Driver 
# db.default.url="jdbc:h2:mem:play" 
# db.default.user=sa 
# db.default.password="" 

db.default.driver=org.postgresql.Driver 
db.default.url=${?DATABASE_URL} 

Procfile.windows

web: target\universal\stage\bin\play-getting-started.bat 
+1

您可以發佈在'的conf/application.conf'文件中的'db.default'條目?你可以發佈你的'Procfile.windows'的內容嗎? – codefinger

回答

-1

您從您的環境中缺少DATABASE_URL。你可以看到這個人db.default.url=${?DATABASE_URL}正在嘗試使用它。

因此,在啓動「激活器運行」或運行「heroku local web -f Procfile.windows」(或其他啓動本地服務器的其他設備)之前,您需要「設置」一個指向要使用的Postgres的鏈接。

本工程爲快速本地黑客(第一次安裝的Postgres在本地,它要求你設置的Postgres用戶的密碼):

set DATABASE_URL=postgres://postgres:<PASSWORD>@localhost:5432/<DB_NAME> 

,這裏是一個你在安裝時設置,以及數據庫的名稱在你想使用的Postgres裏面(使用psql創建一個)。

在此之後,服務器運行。