【发布时间】:2020-08-05 08:10:08
【问题描述】:
我在这个问题上苦苦挣扎了几天,在 SO 上找不到任何东西,heroku 上错误代码的描述对我来说含糊不清。我创建了一个没有数据库集成的基本应用程序,使用 spring 框架,thymeleaf 和 spring mail。我没有 spring 安全性。成功将其部署到 heroku 后,我尝试启动应用程序服务器,这就是我在 heroku 日志中得到的内容。该应用程序在 localhost 上运行良好,没有问题。
2020-08-05T08:03:50.144941+00:00 app[web.1]: 2020-08-05 08:03:50.144 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-05T08:03:50.458342+00:00 app[web.1]: 2020-08-05 08:03:50.458 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-08-05T08:03:50.471638+00:00 app[web.1]: 2020-08-05 08:03:50.471 INFO 4 --- [ main] c.e.P.MyWebWebsiteApplication : Started MyWebWebsiteApplication in 2.688 seconds (JVM running for 3.226)
2020-08-05T08:04:53.993643+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=myweb01.herokuapp.com request_id=0fb69db1-5c01-412e-b01f-451a8a2b7ad8 fwd="86.124.21.129" dyno= connect= service= status=503 bytes= protocol=https
2020-08-05T08:05:16.255402+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2020-08-05T08:05:16.271979+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-05T08:05:16.349020+00:00 heroku[web.1]: Process exited with status 137
2020-08-05T08:05:16.389343+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-05T08:05:16.392175+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-05T08:05:23.662195+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=25487 $JAR_OPTS`
2020-08-05T08:05:25.791836+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-08-05T08:05:25.796964+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
这是我的过程文件:
web: java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=$PORT $JAR_OPTS
阅读日志并在这里找到这个 Tomcat started on port(s): 8080 我想可能是个问题?我的意思是 tomcat 试图在 localhost 端口而不是 heroku 端口上启动?如果是这种情况,我该如何解决?如果不是这种情况,可能是什么问题?
【问题讨论】:
-
devcenter.heroku.com/articles/… for Tomcat 尝试添加
--port $PORT -
我已经阅读了那篇文章,但我有点困惑,我必须在哪里添加?
标签: java spring spring-boot heroku thymeleaf