admin管理员组

文章数量:1356842

My Spring Boot version is 3.4.1 While running from IDE (IntelliJ) everything looks fine. Getting a below-mentioned error while trying to deploy the application on Linux :

.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource' defined in class path resource [/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

In my properties file :

spring.datasource.url=jdbc:mariadb://localhost:3306/database
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.driver-class-name=.mariadb.jdbc.Driver

In my pom :

<dependency>
<groupId>.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>

What have I miss ? Thx

My Spring Boot version is 3.4.1 While running from IDE (IntelliJ) everything looks fine. Getting a below-mentioned error while trying to deploy the application on Linux :

.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource' defined in class path resource [/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

In my properties file :

spring.datasource.url=jdbc:mariadb://localhost:3306/database
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.driver-class-name=.mariadb.jdbc.Driver

In my pom :

<dependency>
<groupId>.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>

What have I miss ? Thx

Share Improve this question edited Mar 28 at 10:56 user30091549 asked Mar 28 at 10:54 user30091549user30091549 11 bronze badge 2
  • What happens when you call Class.forName(".mariadb.jdbc.Driver")? – lance-java Commented Mar 28 at 11:05
  • remove spring.datasource.driver-class-name=.mariadb.jdbc.Driver and let SpringBoot determine it – asgarov1 Commented Mar 28 at 11:17
Add a comment  | 

1 Answer 1

Reset to default 0

The version of spring boot you are using need to have a compatible maria db driver considering the scope mentioned is runtime,still check for that spring boot version which maria db version driver class is compatible,then specify that driver class name,also check in your local whether the mariadb is being connected with the specified spring boot's application.properties details

本文标签: javaSpring boot applicationFailed to determine a suitable driver classStack Overflow