[英]Heroku Spring Boot Gradle App Deployed but App is crashing
I have created Spring Boot Gradle Application with PostgreSQL database and deployed on heroku我已经使用 PostgreSQL 数据库创建了 Spring Boot Gradle 应用程序并部署在 heroku 上
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/gradle
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
remote: -----> Installing JDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew build -x check
remote: To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.2/userguide/gradle_daemon.html#sec:disabling_the_daemon.
remote: Daemon will be stopped at the end of the build
remote: > Task :compileJava
remote: > Task :processResources
remote: > Task :classes
remote: > Task :bootJarMainClassName
remote: > Task :bootJar
remote: > Task :jar
remote: > Task :assemble
remote: > Task :build
remote:
remote: BUILD SUCCESSFUL in 10s
remote: 5 actionable tasks: 5 executed
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 88.2M
remote: -----> Launching...
remote: Released v31
remote: https://lawcase.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/lawcase.git
464da17..2c2db7c main -> main
App is deployed on heroku with this URL https://lawcase.herokuapp.com , I have developed Rest APIs in my Spring Boot APP, I have also added ProcFile应用程序使用此 URL https://lawcase.herokuapp.com部署在 heroku 上,我在 Spring Boot 应用程序中开发了 Rest API,我还添加了 ProcFile
web: java -jar build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar
but when i tried to hit API using URL with Postman但是当我尝试使用 Postman 的 URL 访问 API 时
https://lawcase.herokuapp.com/getprofiles
I am getting 503 Service Unavailable我收到 503 服务不可用
here are the heroku logs这是heroku日志
2021-11-09T08:13:26.000000+00:00 app[api]: Build started by user ahmad.sardar@hotmail.com
2021-11-09T08:13:53.069450+00:00 app[api]: Release v30 created by user ahmad.sardar@hotmail.com
2021-11-09T08:13:53.069450+00:00 app[api]: Deploy 464da17a by user ahmad.sardar@hotmail.com
2021-11-09T08:13:56.790716+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-09T08:13:59.975307+00:00 heroku[web.1]: Starting process with command `java -jar build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar`
2021-11-09T08:14:00.808404+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
2021-11-09T08:14:00.883195+00:00 app[web.1]: no main manifest attribute, in build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar
2021-11-09T08:14:01.026544+00:00 heroku[web.1]: Process exited with status 1
2021-11-09T08:14:01.157284+00:00 heroku[web.1]: State changed from starting to crashed
2021-11-09T08:14:01.179061+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-09T08:14:04.663230+00:00 heroku[web.1]: Starting process with command `java -jar build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar`
2021-11-09T08:14:05.581810+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
2021-11-09T08:14:05.645857+00:00 app[web.1]: no main manifest attribute, in build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar
2021-11-09T08:14:05.769007+00:00 heroku[web.1]: Process exited with status 1
2021-11-09T08:14:06.249030+00:00 heroku[web.1]: State changed from starting to crashed
2021-11-09T08:14:07.000000+00:00 app[api]: Build succeeded
2021-11-09T08:14:45.278393+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=lawcase.herokuapp.com request_id=788e94d4-a03c-4df8-a9aa-d1b68cc69c55 fwd="39.45.237.31" dyno= connect= service= status=503 bytes= protocol=https
2021-11-09T08:14:46.771103+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lawcase.herokuapp.com request_id=35c2d34e-95f2-473c-96f5-b25306390781 fwd="39.45.237.31" dyno= connect= service= status=503 bytes= protocol=https
2021-11-09T08:15:09.157754+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/getprofiles" host=lawcase.herokuapp.com request_id=dfc5e5f1-1ab8-4dd4-9677-c6557e5dae38 fwd="39.45.237.31" dyno= connect= service= status=503 bytes= protocol=https
I have tried different solutions from stackoverflow我尝试了来自 stackoverflow 的不同解决方案
Heroku jar deployment of Spring Boot with Maven Application giving code=H10 带有 Maven 应用程序的 Spring Boot 的 Heroku jar 部署给出代码 = H10
Heroku error code H10 when Spring Boot app is deployed 部署 Spring Boot 应用程序时的 Heroku 错误代码 H10
Spring Boot on Heroku - H10 "app crash" Heroku 上的 Spring Boot - H10“应用程序崩溃”
How can resolve 503 (Service Unavailable) after GET/POST on Spring Boot and Heroku? Spring Boot 和 Heroku 上的 GET/POST 后如何解决 503(服务不可用)?
heroku[web.1]: State changed from starting to crashed heroku[web.1]:状态从开始变为崩溃
But I am unable to solve my problem and my app is not working, could anyone please help how to properly deploy and up my APP on Heroku.但是我无法解决我的问题并且我的应用程序无法运行,任何人都可以帮助如何在 Heroku 上正确部署和启动我的应用程序。
Answering because I can't comment.回答是因为我无法发表评论。 A couple thoughts.
一些想法。 You may not need a Procfile for a Spring Boot app since there is a built-in web server (unless you want to override something).
您可能不需要 Spring Boot 应用程序的 Procfile,因为有一个内置的 Web 服务器(除非您想覆盖某些内容)。 Also found this similar scenario where it was a postgres driver issue.
还发现这种类似的场景是 postgres 驱动程序问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.