简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM