简体   繁体   English

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

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

I've got a very simple dropwizard project (based on the Dropwizard hello world ) that I'd like to deploy to heroku.我有一个非常简单的 dropwizard 项目(基于Dropwizard hello world ),我想将其部署到 heroku。 For a reason I have not yet been able to determine, it fails to run after successfully building in heroku.由于我还无法确定的原因,它在 heroku 中成功构建后无法运行。 It runs fine locally;它在本地运行良好; I only see this error on heroku:我只在 heroku 上看到这个错误:

heroku log: 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

The thing is, as far as I can tell, my hello-world.yml doesn't have an "http" field....事情是,据我所知,我的 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

My Procfile, for good measure:我的Procfile,很好的衡量标准:

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

The reason my yml file looks like it does is that I saw this Google Groups post about the same error... unfortunately, the posted solution doesn't seem to work for me.我的 yml 文件看起来像它的原因是我看到这个 Google Groups 帖子关于相同的错误......不幸的是,发布的解决方案似乎对我不起作用。

Any thoughts?有什么想法吗?

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