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

2,062 views
Skip to first unread message

Pablo Sánchez

unread,
Feb 14, 2021, 3:18:55 AM2/14/21
to firebi...@googlegroups.com, safari...@vera.com.uy
I have a spring-boot app  (v2.3.5.RELEASE), using jaybird 3.0.10 on firebird 2.5.9.27139

On application.properties I configured:
spring.datasource.url=jdbc:firebirdsql://localhost:3050//mypath/dbsupport.fdb?encoding=ISO8859_1
spring.datasource.username=SYSDBA
spring.datasource.password=mypassword
Here's build.gradle
plugins {
    id 'org.springframework.boot' version '2.3.5.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'java'
}
group = 'com.supportapp'
version = '1.0'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation    'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
    
    
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    
    implementation 'org.webjars:font-awesome:5.15.1'
    implementation 'org.webjars:webjars-locator:0.40'
    implementation 'org.webjars:jquery:3.5.1'
    implementation 'org.webjars:bootstrap:4.5.3'
    implementation 'org.webjars:popper.js:2.5.2'
    
        
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'

    compileOnly 'org.projectlombok:lombok:1.18.16'
    annotationProcessor 'org.projectlombok:lombok:1.18.16'
    
    runtimeOnly 'org.firebirdsql.jdbc:jaybird:3.0.10'
    runtimeOnly "org.springframework.boot:spring-boot-devtools"


Project worked fine, so far...
After a couple of weeks I opened the project, and when I run the app, I get the title of this post followed by:

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


Description error on the log is :
2021-02-13 19:36:35.937  WARN 20629 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inMemoryDatabaseShutdownExecutor' defined in class path resource [org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'inMemoryDatabaseShutdownExecutor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

I tried using version 4 of jaybird but still stuck on this .

Howto ???

Regards

Pablo

Pablo Sánchez

unread,
Feb 14, 2021, 3:18:55 AM2/14/21
to firebi...@googlegroups.com
To my surprise, after checking for anything "strange" (as changing spring.datasource.url and build.gradle), I found tha if I run the jar file, works correctly ...

This is odd ...


De: "Pablo Sánchez" <safari...@vera.com.uy>
Para: firebi...@googlegroups.com
CC: safari...@vera.com.uy
Enviados: Sábado, 13 de Febrero 2021 19:53:29
Asunto: Spring Boot :Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Mark Rotteveel

unread,
Feb 14, 2021, 3:54:13 AM2/14/21
to firebi...@googlegroups.com
On 13-02-2021 23:53, Pablo Sánchez wrote:
> I have a spring-boot app  (v2.3.5.RELEASE), using jaybird 3.0.10 on
> firebird 2.5.9.27139
>
> On application.properties I configured:
> spring.datasource.url=jdbc:firebirdsql://localhost:3050//mypath/dbsupport.fdb?encoding=ISO8859_1
> spring.datasource.username=SYSDBA
> spring.datasource.password=mypassword

[..]

> Project worked fine, so far...
> After a couple of weeks I opened the project, and when I run the app, I
> get the title of this post followed by:
>
> 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).

Given the error is "Failed to configure a DataSource: 'url' attribute is
not specified", that sounds like Spring Boot doesn't see your
application properties.

The second error is a follow-up error for that.

I can reproduce this exact error message with a simple Spring Boot
application by commenting out the spring.datasource.url property.

Try specifying --debug as a program argument, and check the logging if
it is loaded the configuration files you expect.

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Feb 14, 2021, 3:55:46 AM2/14/21
to firebi...@googlegroups.com
On 14-02-2021 03:04, Pablo Sánchez wrote:
> To my surprise, after checking for anything "strange" (as changing
> spring.datasource.url and build.gradle), I found tha if I run the jar
> file, works correctly ...
>
> This is odd ...

Does this mean the problem is solved, or does the problem occur if you
run the application in a different way than through the JAR? If so, how
do you run it.

And as I suggested in my previous post, specify --debug and check the
logging which configuration files it picks up.

Mark
--
Mark Rotteveel

Pablo Sánchez

unread,
Feb 20, 2021, 1:58:50 AM2/20/21
to firebi...@googlegroups.com
Well, actually what is happening here is I seem to fail to create a git
repository and add to the index the correct files. It's a gradle project .

The repo (local one) is created ok, as I see the working tree seems fine,
but application.properties is not read on startup.

I'm now still searching on the web on this problem....

Regards

Pablo


----- Mensaje original -----
De: "Mark Rotteveel" <ma...@lawinegevaar.nl>
Para: firebi...@googlegroups.com
Enviados: Domingo, 14 de Febrero 2021 5:55:42
Asunto: Re: [firebird-java] Re: Spring Boot :Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
--
You received this message because you are subscribed to the Google Groups "firebird-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-jav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-java/b157bdd7-8c27-7781-d0cc-62a34f37859d%40lawinegevaar.nl.

Pablo Sánchez

unread,
Feb 20, 2021, 1:59:02 AM2/20/21
to firebi...@googlegroups.com
I've just recreated the application.properties file from zero and is working now.
Seems that the trip to the local git repo, have affected how text is handled.
Now, none of html pages work . It's going to be a heck of a weekend ...

Dismiss this problem .

Thank for your time.

Regards,

Pablo

----- Mensaje original -----
Enviados: Viernes, 19 de Febrero 2021 18:45:15
Reply all
Reply to author
Forward
0 new messages