【问题标题】:Simple web java app works with heroku local web, but when deployed it crashes简单的 web java 应用程序可以与 heroku 本地 web 一起使用,但是在部署时它会崩溃
【发布时间】:2020-03-12 12:54:43
【问题描述】:

我在我的 web java 应用程序中使用 maven 3 和 JDK8。当我使用 heroku 本地网络运行它时,它工作得很好。该应用程序的部署也可以正常工作,但是当我尝试访问任何路线时,我会收到以下错误消息:

2019-11-16T16:18:12.213730+00:00 heroku[web.1]: State changed from crashed to starting
2019-11-16T16:18:14.828031+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=5000 -cp target/classes:target/dependency/* Server`
2019-11-16T16:18:16.737715+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-11-16T16:18:16.741192+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-11-16T16:18:16.852336+00:00 app[web.1]: Servidor à espera de ligações no porto 5000
2019-11-16T16:19:45.407156+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-16T16:19:45.285183+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-11-16T16:19:45.285183+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-11-16T16:19:45.382598+00:00 heroku[web.1]: Process exited with status 137
2019-11-16T16:22:20.485432+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sd-back-end.herokuapp.com request_id=6b2ff817-990a-4b10-bd4d-fb2a929ea1fc fwd="149.90.124.74" dyno= connect= service= status=503 bytes= protocol=https
2019-11-16T16:22:20.951050+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sd-back-end.herokuapp.com request_id=894ab47b-a10d-4467-84b3-7ed824b6ff7c fwd="149.90.124.74" dyno= connect= service= status=503 bytes= protocol=https

过程文件:

web: java -Dserver.port=5000 -cp target/classes;target/dependency/* Server

这个应用的代码:https://github.com/EDUnter/SD_Server

【问题讨论】:

标签: java web heroku deployment


【解决方案1】:

-Dserver.port=5000 替换为-Dserver.port=$PORT

欲了解更多信息,请参阅Setting the HTTP Port for Java Applications

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 2020-12-08
    • 2019-07-26
    • 1970-01-01
    • 2012-08-30
    相关资源
    最近更新 更多