[英]Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch - Heroku
[英]Running Dropwizard app on Heroku: R10 failed to bind to $PORT
我最近指出了dropwizard和heroku的方向,以便相對容易地創建和部署restFUL web服務。
在http://dropwizard.readthedocs.org/en/latest/getting-started.html上關注入門教程后,我很快就在我的localhost上運行了一個簡單的Hello World服務,沒有任何問題。
繼續試圖在Heroku上部署它我遇到了一個問題。 在將應用程序部署到heroku時,我收到錯誤消息
2014-08-14T11:34:59.869067+00:00 heroku[web.1]: State changed from starting to crashed
2014-08-14T11:34:59.070364+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web
process failed to bind to $PORT within 60 seconds of launch
2014-08-14T11:34:59.070573+00:00 heroku[web.1]: Stopping process with SIGKILL
2014-08-14T11:34:59.857478+00:00 heroku[web.1]: Process exited with status 137
我的Procfile看起來像....
web java $JAVA_OPTS -D.http.port=$PORT -jar target/exampleMavenProject-0.0.1-SNAPSHOT.jar server hello-world.yml
這與在本地主機上運行應用程序的命令行代碼完全相同,但不包括
$JAVA_OPTS -D.http.port=$PORT
$ jAVA_OPTS在herkou app配置變量中定義; 從我的理解,$ PORT不能被覆蓋。
除了dropwizard示例所需的那些之外,hello-world.yml中沒有任何額外的配置變量
template: Hello, %s!
defaultName: Stranger
有沒有人有任何建議,為什么這不起作用?
謝謝。
Dropwizard 0.7.x改變了他們的服務器配置; 特別是, http.port
不再起作用了。
相反,您應該使用server.connector.port
作為procfile / .yml文件。 這是一個例子:
Procfile
web: java $JAVA_OPTS -Ddw.server.connector.port=$PORT -jar target/pos-tagger-1.0-SNAPSHOT.jar server src/main/resources/POSTagger.yml
POSTagger.yml
server:
type: simple
applicationContextPath: /
adminContextPath: /admin
connector:
type: http
port: 8080
如果你想看到一個完整的,使用0.7.x的工作heroku示例,請查看: https : //github.com/xinranxiao/POSTagger
使用Gradle更新Dropwizard 1.0:
Procfile
web: java $JAVA_OPTS -Ddw.server.applicationConnectors[0].port='$PORT' -jar build/libs/yourJar-1.0-all.jar server config-production.yml
配置-production.yml
server:
registerDefaultExceptionMappers: false
applicationConnectors:
- type: http
port: 8080
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.