Heroku Spring Boot Gradle应用程序已部署,但应用程序正在崩溃



我已经用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

使用此URL在heroku上部署应用程序https://lawcase.herokuapp.com,我在我的Spring Boot应用程序中开发了Rest API,我还添加了ProcFile

web: java -jar build/libs/LawCase-0.0.1-SNAPSHOT-plain.jar

但当我尝试使用Postman 使用URL访问API时

https://lawcase.herokuapp.com/getprofiles

我得到503服务不可用

这是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

我尝试了来自stackoverflow 的不同解决方案

Heroku jar部署带有Maven应用程序的Spring Boot,给出代码=H10

部署SpringBoot应用程序时的Heroku错误代码H10

Heroku上的弹簧靴-H10";应用程序崩溃";

如何在Spring Boot和Heroku上的GET/POST之后解决503(服务不可用(?

heroku[web.1]:状态从启动更改为崩溃

但我无法解决我的问题,我的应用程序也不工作,有人能帮助我如何在Heroku上正确部署和升级我的应用吗。

因为我不能发表评论而回答。几个想法。Spring Boot应用程序可能不需要Procfile,因为它有一个内置的web服务器(除非你想覆盖某些内容(。还发现了类似的情况,其中是postgres驱动程序问题。

最新更新