简体   繁体   English

Spring 部署在 Heroku 上的引导应用程序仍然崩溃

[英]Spring Boot application deployed on Heroku still crashing

i deployed my Spring app on Heroku but it crashes every time.我在 Heroku 上部署了我的 Spring 应用程序,但它每次都崩溃。 Application works fine on localhost and also seems to correctly starting on Heroku but after one minute it crashes.应用程序在 localhost 上运行良好,并且似乎在 Heroku 上正确启动,但一分钟后它崩溃了。 I can't even open it because i've got timeout.我什至无法打开它,因为我有超时。 I attached end of the logs:我附上了日志的结尾:

2020-04-09T15:29:42.942785+00:00 app[web.1]: 2020-04-09 15:29:42.942  INFO 4 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-04-09T15:29:42.945506+00:00 app[web.1]: 2020-04-09 15:29:42.945  INFO 4 --- [           main] c.a.a.backend.BackendApplication  : Started BackendApplication in 15.604 seconds (JVM running for 17.531)
2020-04-09T15:30:53.816851+00:00 heroku[web.1]: State changed from starting to crashed

There is nothing more in logs.日志中没有更多内容。 What can i check?我可以检查什么?

It looks like you're not binding your tomcat to the correct port.看起来您没有将 tomcat 绑定到正确的端口。 You need to bind to the Heroku provided $PORT env variable.您需要绑定到 Heroku 提供的$PORT环境变量。 Heroku has an article about this, that also covers Tomcat: https://devcenter.heroku.com/articles/setting-the-http-port-for-java-applications Heroku has an article about this, that also covers Tomcat: https://devcenter.heroku.com/articles/setting-the-http-port-for-java-applications

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM