Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
728 views
in Technique[技术] by (71.8m points)

java - Deploying spring boot application to heroku - error message "App crashed"

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

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 apparently the app crashed:

2020-02-09T17:15:47.060408+00:00 heroku[web.1]: Process exited with status 1 2020-02-09T17:15:49.097143+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=blooming-flowers-53454.herokuapp.com request_id=a1f16198-0b1d-4ef5-8fe4-46f7c5948230 fwd="95.88.203.176" dyno= connect= service= status=503 bytes= protocol=https

2020-02-09T17:15:50.127601+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=blooming-flowers-53454.herokuapp.com request_id=c463c2ed-6660-429d-88fd-52172fcd5677 fwd="95.88.203.176" dyno= connect= service= status=503 bytes= protocol=https

Why does the app run locally without problems but crashes on heroku?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After studying the logs in more detail I found out what caused the problem. The file application.properties was configured for a MySQL database (which I used locally).

I changed the content of the file, which now looks as follows:

spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.maxActive=10
spring.datasource.maxIdle=5
spring.datasource.minIdle=2
spring.datasource.initialSize=5
spring.datasource.removeAbandoned=true
spring.jpa.hibernate.ddl-auto=create

Now everything works.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...