Failed to determine a suitable driver class

See original GitHub issue

Spring Boot Version: 2.0.3.RELEASE

application.properties

###--- Database   ---###
spring.datasource.url = jdbc:mysql://localhost:3306/mydb
spring.datasource.username = root
spring.datasource.password = password
spring.datasource.platform = mysql
spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto = create
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

Pom.xml contains

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    ... 
        <!-- Database dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
    </dependencies>

When I run my application, I get following error

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-17 12:31:12.528 ERROR 15387 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

After searching for a bit, I found that if I use earlier versions like 1.5.13.RELEASE this doesn’t happen.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ghsatputecommented, Dec 15, 2018

Apologies for replying late, I was not able to isolate the issue but now I did and came here to give the solution.

My application organization looked like below

 Commons 
        |
        ↓
    Module1

Commons was a parent to Module1.

I had created a BaseEntity having JPA annotations in my commons module. The commons dependency was specified as

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>

Once I added the <scope>provided</scope>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<scope>provided</scope>
		</dependency>

The issue got resolved for me. Unfortunately, I’m not able to do further analysis nor I can share the code.

1reaction
trantienduchncommented, Feb 19, 2019

I got the same problem with spring-boot 2.1.3 RELEASE. I marked my project with <packaging>pom</packaging> (stupid) so It didn’t work, removing this resolved my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving Failed to Configure a DataSource Error - Baeldung
Learn what causes the Spring Boot error "Failed to configure a DataSource" and how ... Reason: Failed to determine a suitable driver class...
Read more >
Springboot postgres Failed to determine a suitable driver class
I am trying to develop web application using SpringBoot and Postgres Database. However, on connecting to the application, I am getting error " ......
Read more >
Failed to configure a DataSource: 'url' attribute is ... - Yawin Tutor
Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please...
Read more >
Solving the error Failed to auto-configure a DataSource
This tutorial will help you to solve the error Failed to auto-configure a ... Reason: Failed to determine a suitable driver class.
Read more >
Spring Boot - Cannot determine embedded database driver ...
Cannot determine embedded database driver class for database type NONE ... This error comes when you don't have a DataSource configured for your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found