繁体   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