简单的Web Java应用程序可与heroku本地网络一起使用,但是在部署时会崩溃

我在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

Procfile

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

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

jl316 回答:简单的Web Java应用程序可与heroku本地网络一起使用,但是在部署时会崩溃

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

有关更多信息,请参见Setting the HTTP Port for Java Applications

本文链接:https://www.f2er.com/3089457.html

大家都在问