簡體   English   中英

將 dropwizard 項目部署到 heroku 時,yaml 中的“無法識別的字段:http”

[英]“Unrecognized Field: http” in yaml when deploying dropwizard project to heroku

我有一個非常簡單的 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 文件看起來像它的原因是我看到這個 Google Groups 帖子關於相同的錯誤......不幸的是,發布的解決方案似乎對我不起作用。

有什么想法嗎?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM