将dropwizard项目部署到heroku时,yaml中的“无法识别的字段:http”

问题描述 投票:0回答:1

我有一个非常简单的dropwizard项目(基于Dropwizard hello world),我想部署到heroku。由于我还没有确定的原因,它在成功构建heroku后无法运行。它在当地运行良好;我只在heroku上看到这个错误:

heroku日志:

2016-05-11T06:11:35.276279+00:00 heroku[slug-compiler]: Slug compilation started
2016-05-11T06:11:35.276284+00:00 heroku[slug-compiler]: Slug compilation finished
2016-05-11T06:11:35.317873+00:00 heroku[web.1]: State changed from crashed to starting
2016-05-11T06:11:37.914144+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Ddw.http.port=56125 -Ddw.http.adminPort=56125 -jar target/myapp-1.0-SNAPSHOT.jar server hello-world.yml`
2016-05-11T06:11:39.645193+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-05-11T06:11:39.648486+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-05-11T06:11:40.723314+00:00 app[web.1]: hello-world.yml has an error:
2016-05-11T06:11:40.723347+00:00 app[web.1]:   * Unrecognized field at: http
2016-05-11T06:11:40.723348+00:00 app[web.1]:     Did you mean?:
2016-05-11T06:11:40.723372+00:00 app[web.1]:       - metrics
2016-05-11T06:11:40.723373+00:00 app[web.1]:       - server
2016-05-11T06:11:40.723374+00:00 app[web.1]:       - logging
2016-05-11T06:11:40.723374+00:00 app[web.1]:       - defaultName
2016-05-11T06:11:40.723375+00:00 app[web.1]:
2016-05-11T06:11:41.637830+00:00 heroku[web.1]: State changed from starting to crashed
2016-05-11T06:11:41.614715+00:00 heroku[web.1]: Process exited with status 1

事情是,据我所知,我的hello-world.yml没有“http”字段....

defaultName: steve
server:
  type: simple
  applicationContextPath: /
  #adminContextPath: /admin # If you plan to use an admin path, you'll need to also use non-root app path
  connector:
    type: http
    port: 8080

我的Procfile,很好的措施:

web: java $JAVA_OPTS -Ddw.http.port=$PORT -Ddw.http.adminPort=$PORT -jar target/myapp-1.0-SNAPSHOT.jar server hello-world.yml

我的yml文件看起来像它的原因是我看到this Google Groups post有关同样的错误...不幸的是,发布的解决方案似乎不适合我。

有什么想法吗?

java heroku yaml dropwizard
1个回答
4
投票

Dropwizard将任何系统属性与前缀'dw'合并到其配置中,因此错误实际上是指'-Ddw.http.port=$PORT' - 将其更改为以下内容,以便它与配置文件的结构相匹配。

#
java $JAVA_OPTS -Ddw.server.connector.port=$PORT -jar target/myapp-1.0-SNAPSHOT.jar server hello-world.yml
#
© www.soinside.com 2019 - 2024. All rights reserved.