Audry
Audry
RRailway
Created by Audry on 11/19/2023 in #✋|help
Failing to connect Spring Boot with PostgreSQL with jdbc
Hello all! I am having issues trying to deploy my spring boot project. Everything works fine on localhost. The issue seems to be with jdbc when trying to deploy. I made sure to create a postgreSQL project and provide the DATABASE_PRIVATE_URL variable to the spring boot project, and the following is the error message I get through the logs: ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class Description: Failed to configure a DataSource: no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Here it is the section of the properties file that's relevant to the datasource spring.datasource.url=jdbc:${DATABASE_PRIVATE_URL} spring.datasource.username=${POSTGRES_USER} spring.datasource.password=${POSTGRES_PASSWORD} spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true javax.persistence.schema-generation.scripts.action=drop-create spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect server.error.include-message = "always" spring.jpa.properties.hibernate.jdbc.time_zone=UTC spring.mvc.format.date-time=iso spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false Any help will be really appreciated !
10 replies