java – 在Heroku上运行Dropwizard应用程序:R10无法绑定到$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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |