Failed to auto-configure a DataSource: 'spring.datasource.url'

AjFmO :

I'm really new into Spring, specifically Spring Boot. Please I beg you, be the most explicit possible, give me docs to read so I can understand very well what I have to do.

My project is using MySQL+JavaFX+Spring Boot+Spring Data JPA+Hibernate frameworks/technologies.

This is my POM file.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nubeclick</groupId>
<artifactId>pos</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>POSNubeClick</name>
<description>Sistema de punto de venta (Point Of Sale).</description>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <slf4j.version>1.7.12</slf4j.version>
    <log4j.version>1.2.17</log4j.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
    <dependency>
        <groupId>com.miglayout</groupId>
        <artifactId>miglayout-javafx</artifactId>
        <version>5.0</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <!-- <dependency> -->
    <!-- <groupId>org.slf4j</groupId> -->
    <!-- <artifactId>slf4j-api</artifactId> -->
    <!-- <version>${slf4j.version}</version> -->
    <!-- </dependency> -->
    <!-- <dependency> -->
    <!-- <groupId>org.slf4j</groupId> -->
    <!-- <artifactId>jcl-over-slf4j</artifactId> -->
    <!-- <version>${slf4j.version}</version> -->
    <!-- </dependency> -->
    <!-- <dependency> -->
    <!-- <groupId>org.slf4j</groupId> -->
    <!-- <artifactId>slf4j-log4j12</artifactId> -->
    <!-- <version>${slf4j.version}</version> -->
    <!-- </dependency> -->
    <!-- <dependency> -->
    <!-- <groupId>log4j</groupId> -->
    <!-- <artifactId>log4j</artifactId> -->
    <!-- <version>${log4j.version}</version> -->
    <!-- </dependency> -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.jfoenix</groupId>
        <artifactId>jfoenix</artifactId>
        <version>1.10.0</version>
    </dependency>
    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx</artifactId>
        <version>8.9</version>
    </dependency>
    <dependency>
        <groupId>org.controlsfx</groupId>
        <artifactId>controlsfx</artifactId>
        <version>8.40.13</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

This is my .properties configuration.

spring.main.banner-mode=off

# Datasource connection properties
spring.datasource.url=jdbc:mysql://localhost/posnubeclick
spring.datasource.username=nubeclick
spring.datasource.password=nubeclick
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# JPA Properties
spring.jpa.database=posnubeclick

# Hibernate Configuration Properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.current_session_context_class=thread
spring.jpa.properties.hibernate.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

# Naming strategy
spring.jpa.hibernate.naming-strategy =org.hibernate.cfg.ImprovedNamingStrategy

#Turn Statistics on
spring.jpa.properties.hibernate.generate_statistics=true

# logging
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
logging.level.org.hibernate.stat=debug
logging.level.org.hibernate.type=trace
logging.level.org.hibernate.SQL=debug
#logging.level.org.hibernate.type.descriptor.sql=trace
logging.level.=error

This is my main class

@SpringBootApplication(scanBasePackages = { "com.nubeclick.pos" })
public class MainApp extends Application {

private static final Logger log = LoggerFactory.getLogger(MainApp.class);

public static void main(String[] args) throws Exception {

    SpringApplication.run(MainApp.class, args);
    // launch(args);
}

@Override
public void start(Stage stage) throws Exception {
    try {
        log.info("Starting Hello JavaFX and Maven demonstration application");

        String fxmlFile = "/fxml/Main.fxml";
        log.debug("Loading FXML for main view from: {}", fxmlFile);
        FXMLLoader loader = new FXMLLoader();
    Parent rootNode = (Parent) loader.load(getClass().getResourceAsStream(fxmlFile));

        log.debug("Showing JFX scene");
        Scene scene = new Scene(rootNode);
        scene.getStylesheets().add("/styles/styles.css");
        stage.setTitle("NubeClick - Point of Sales");
        stage.setScene(scene);
        stage.show();
    } catch (Exception e) {
    // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

This is the stacktrace:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor 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

The Spring message is this:

Description:

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-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).

I have refered to this other post and this other one

I don't know what else to do, maybe start all over again from zero but I want to adapt those frameworks to my current project.

What can I do to solve this?

Edit


Crazy thing, I decided to upload the project to another repository, did a whole clean to the project folder (deleted .project, .settings, .classpath, bin, target) and reimported project into eclipse, did configure -> add maven nature, and now the error is gone, at least this error, got some other errors but now it loads everything from the properties file, so, Why did this happened?

AjFmO :

I decided to upload the project to another repository, did a whole clean to the project folder (deleted .project, .settings, .classpath, bin, target) and reimported project into eclipse, did configure -> add maven nature, and now the error is gone, at least this error, got some other errors but now it loads everything from the properties file, so, Why did this happened?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

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

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

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

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified

Spring Boot auto configuration for datasource

Spring Boot auto configuration for datasource

Springboot + JSP + Spring Security: Failed to configure a DataSource

Configure Multiple DataSource in Spring Boot with JNDI

Configure DataSource programmatically in Spring Boot

Failed to configure a DataSource: 'url'

Is it mandatory to configure DataSource in Spring starter project?

Failed to configure a DataSource: Intellij Error when connecting Database to Spring Application

Cannot resolve this error: Failed to configure a DataSource

Gradle project --Failed to configure a DataSource'url' attribute is not specified and no embedded datasource could be configured

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

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

Failed to configure a DataSource: 'url' attribute is not specified using Spring Boot

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

spring.datasource.url not found

How do you configure a DataSource in Spring?

configure dataSource for liquibase in spring boot

Spring boot: configure hsqldb datasource to persist data

SpringBoot2 Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured

Failed to configure a DataSource from command line

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

how does spring boot auto configure the driver of a special datasource?

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

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

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  3. 3

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    Do Idle Snowflake Connections Use Cloud Services Credits?

  9. 9

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  10. 10

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  11. 11

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  12. 12

    Generate random UUIDv4 with Elm

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  17. 17

    EXCEL: Find sum of values in one column with criteria from other column

  18. 18

    Pandas - check if dataframe has negative value in any column

  19. 19

    How to use merge windows unallocated space into Ubuntu using GParted?

  20. 20

    Make a B+ Tree concurrent thread safe

  21. 21

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

HotTag

Archive