将 spring boot 应用程序部署到 heroku - 错误消息“没有 Web 进程正在运行" [英] Deploying spring boot application to heroku - error message "No web processes running"

查看:32
本文介绍了将 spring boot 应用程序部署到 heroku - 错误消息“没有 Web 进程正在运行"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 spring boot web 应用程序(在 IntelliJ IDEA 中),它在本地运行没有问题.

然后我构建了一个工件(Build -> Build Artifacts... -> my_app:jar -> Build),它在目录out"中创建了一个 jar 文件.

我尝试完全按照 heroku 在本演练中描述的步骤将应用程序部署到 heroku:

Pom(带有 WebRunner 插件)Demo Application(注意SpringBootServletInitializer的使用).如果你不使用它,你会得到 404.

首页

Heroku 日志

I created a spring boot web application (in IntelliJ IDEA), which runs locally without problems.

I then built an artifact (Build -> Build Artifacts... -> my_app:jar -> Build), which created a jar file in directory "out".

I tried to deploy the app to heroku following exactly the steps described in this walkthrough by heroku: https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku

Note: the walkthrough does not mention a Procfile so I didn't create one.

When opening the app's address in the browser I faced an "Application error".

The logs show that building the app was successful but there are apparently "No web processes running":

2020-02-06T20:42:19.262364+00:00 app[api]: Release v1 created by user michaels@icloud.com 2020-02-06T20:42:19.598724+00:00 app[api]: Release v2 created by user michaels@icloud.com 2020-02-06T20:42:19.262364+00:00 app[api]: Initial release by user michaels@icloud.com 2020-02-06T20:42:19.598724+00:00 app[api]: Enable Logplex by user michaels@icloud.com 2020-02-06T20:46:11.000000+00:00 app[api]: Build started by user michaels@icloud.com 2020-02-06T20:46:56.626428+00:00 app[api]: Release v3 created by user michaels@icloud.com 2020-02-06T20:46:56.626428+00:00 app[api]: Deploy 93b6dfea by user michaels@icloud.com 2020-02-06T20:47:04.000000+00:00 app[api]: Build succeeded 2020-02-06T20:48:22.485742+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=my-app.herokuapp.com request_id=22e30a92-5094-4f8b-a51c-3f21177b19dc fwd="95.88.203.176" dyno= connect= service= status=503 bytes= protocol=https

I checked whether a dyno was running using the following command:

heroku ps

Result:

No dynos on ⬢ infinite-sky-81114

I then ran the following command to start a dyno:

heroku ps:scale web=1

Result:

Scaling dynos... ! ▸ Couldn't find that process type (web).

So the application doesn't run because there is no dyno - but I am not able to start a dyno.

How can I make this work?

解决方案

Assuming you are using JAR, Procfile will be created by default. Are you sure your web dyno is still running ? If you are using cli, you could check using heroku ps to see what is the status. If it says no dynos you can scale up using heroku ps:scale web=1 and try heroku open to launch app.

If your using WAR you can follow https://devcenter.heroku.com/articles/war-deployment and yes you need the Procfile.

Also while running the spring boot application on standalone tomcat don't forget to follow steps here https://docs.spring.io/spring-boot/docs/2.1.10.RELEASE/reference/html/howto-traditional-deployment.html

Here are some screen shots that I took while doing spring boot heroku integration.

ProcFile

Pom (with WebRunner plugin) Demo Application (Note the use of SpringBootServletInitializer). You will get 404 if you don't use it.

Home page

Heroku logs

这篇关于将 spring boot 应用程序部署到 heroku - 错误消息“没有 Web 进程正在运行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆