簡體   English   中英

將 spring boot 應用程序部署到 heroku - 錯誤消息“應用程序崩潰”

[英]Deploying spring boot application to heroku - error message "App crashed"

我創建了一個 Spring Boot Web 應用程序(在 IntelliJ IDEA 中),它在本地運行沒有問題。

我嘗試完全按照heroku在本演練中描述的步驟將應用程序部署到heroku: https ://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku

注意:演練沒有提到 Procfile,所以我沒有創建一個。

在瀏覽器中打開應用程序的地址時,我遇到了“應用程序錯誤”。

日志顯示該應用程序顯然崩潰了:

2020-02-09T17:15:47.060408+00:00 heroku[web.1]: 進程退出狀態為 1 2020-02-09T17:15:49.097143+00:00 heroku[router]: at=error code=H10 desc ="應用程序崩潰" method=GET path="/" host=blooming-flowers-53454.herokuapp.com request_id=a1f16198-0b1d-4ef5-8fe4-46f7c5948230 fwd="95.88.203.176" dyno= connect= service= 503 字節=協議=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

為什么應用程序在本地運行沒有問題,但在 heroku 上崩潰?

在更詳細地研究日志后,我發現了導致問題的原因。 文件 application.properties 是為 MySQL 數據庫(我在本地使用的)配置的。

我更改了文件的內容,現在看起來如下:

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

現在一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM