Spring 在 Heroku 中使用 Postgresql 部署启动 MVC 应用程序失败
Spring Boot MVC application with Postgresql deployment failed in Heroku
我有一个 Spring Boot MVC 项目。它适用于 h2 数据库,也适用于具有以下 application.properties 配置的本地 postgre 数据库
spring.datasource.url=myUrl
spring.datasource.username=myUsername
spring.datasource.password=myPassword
但是当我尝试在 Heroku 中部署它时出现以下错误:
Caused by: org.hibernate.HibernateException: Access to
DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
如果我使用这个配置
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=herokuPostgreSqlDbUrl
spring.datasource.username=herokuUsername
spring.datasource.password=mherokuPassword
我在尝试从 STS 运行 我的项目但部署失败时收到此信息。
Caused by: java.sql.SQLException: Driver:org.postgresql.Driver@17a3dff6
returned null for URL:myUrl
我的 pom 是:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1206-jdbc42</version>
</dependency>
任何人都可以帮忙吗?
你需要一个合适的JDBCurl。参见:https://springframework.guru/configuring-spring-boot-for-postgresql/
我有一个 Spring Boot MVC 项目。它适用于 h2 数据库,也适用于具有以下 application.properties 配置的本地 postgre 数据库
spring.datasource.url=myUrl
spring.datasource.username=myUsername
spring.datasource.password=myPassword
但是当我尝试在 Heroku 中部署它时出现以下错误:
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
如果我使用这个配置
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=herokuPostgreSqlDbUrl
spring.datasource.username=herokuUsername
spring.datasource.password=mherokuPassword
我在尝试从 STS 运行 我的项目但部署失败时收到此信息。
Caused by: java.sql.SQLException: Driver:org.postgresql.Driver@17a3dff6 returned null for URL:myUrl
我的 pom 是:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1206-jdbc42</version>
</dependency>
任何人都可以帮忙吗?
你需要一个合适的JDBCurl。参见:https://springframework.guru/configuring-spring-boot-for-postgresql/