Fix: Failed to configure a DataSource: url attribute is not specified [Spring Data JPA]


***************************
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).


Process finished with exit code 1

If you are making use of the spring-boot-starter-data-jpa in your application and when you start your application, you get the above error, one common reason for this is that you have missed adding the datasouce url path in either of application.properties or application.yml file.

Make sure you have the below property added.

spring.datasource.url

Example:
spring.datasource.url=jdbc:mysql://localhost:3306/db2

If using application.yml,

spring:
  datasource:
      url: jdbc:oracle:thin:@localhost:1521:db1
spring.datasource

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap