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?
Advertisement
Answer
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.
Pom (with WebRunner plugin) Demo Application (Note the use of SpringBootServletInitializer). You will get 404 if you don’t use it.