繁体   English   中英

Spring Boot: Heroku 部署成功后报错

[英]Spring Boot : Heroku errors after successful deployment

我在这个问题上苦苦挣扎了几天,在 SO 上找不到任何东西,并且 heroku 上的错误代码描述对我来说是模糊的。我创建了一个没有数据库集成的基本应用程序,使用 spring framework, thymeleaf and spring mail.I have no spring security.After successfully deploying it to heroku i try to start the application server and this is what i get in the heroku logs.The app works fine on localhost with no issue.

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 端口上启动?如果是这种情况,我该如何解决? 如果不是这种情况,可能是什么问题?

这里的文档错误代码 H20 意味着

路由器将在等待启动进程到达“up”state 时将请求排队 75 秒。 如果 75 秒后,没有 web 测功机达到“向上” state,路由器将记录 H20 并提供标准错误页面

如果您的应用程序需要更多时间来启动,您可以使用启动超时工具来增加限制。 但是,一般来说,缓慢的启动时间会使部署应用程序变得更加困难,并且会使从测功机故障中恢复的速度变慢,因此这应该被视为临时解决方案

尝试将启动超时设置为 120 秒 - 一些 SpringBoot 应用程序需要一些时间才能启动。 该请求可以如下所示完成: https://devcenter.heroku.com/changelog-items/364

此外,健康检查过程基于 HTTP 请求,因此请确保您的应用程序通过正常的 Web 端口(80、8080、443)提供服务。

暂无
暂无

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

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