IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

Configure Datasource URL


Sujet :

Spring Java

  1. #1
    Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juillet 2022
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juillet 2022
    Messages : 2
    Points : 4
    Points
    4
    Par défaut Configure Datasource URL
    Bonjour à tous, j'ai un petit soucis lors de lancement de mon application Java Spring, je souhaite me connecter à une BDD postgresql , le soucis c'est que lors du lancement j'ai ce message d'erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ***************************
    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
    Mon application.properties de dev :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    server.port = 8080
    spring.datasource.url=jdbc:postgresql://localhost:5432/BuyMeDB
    spring.datasource.username=postgres
    spring.datasource.password=*******
    spring.datasource.driver-class-name=org.postgresql.Driver
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
    spring.jpa.show-sql=true
    spring.jpa.hibernate.ddl-auto=create

    application.properties :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    spring.profiles.active = dev
    Pom.xml :

    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    <?xml version="1.0" encoding="UTF-8"?>
    <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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<parent>
    		<groupId>org.springframework.boot</groupId>
    		<artifactId>spring-boot-starter-parent</artifactId>
    		<version>2.4.1</version>
    		<relativePath/>
    		<!-- lookup parent from repository -->
    	</parent>
    	<groupId>com.BuyMe</groupId>
    	<artifactId>BuyMeAPI</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<name>BuyMeAPI</name>
    	<description>Rental of equipment of all kinds, project for educational purposes</description>
    	<packaging>jar</packaging>
    	<properties>
    		<project.build.sourceEnconding>UTF-8</project.build.sourceEnconding>
    		<project.build.outputEnconding>UTF-8</project.build.outputEnconding>
    		<java.version>1.8</java.version>
    	</properties>
    	<dependencies>
    		<!-- Spring Starter web -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-web</artifactId>
    		</dependency>
    		<!-- Spring devtools -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-devtools</artifactId>
    			<scope>runtime</scope>
    			<optional>true</optional>
    		</dependency>
    		<!-- Lombok -->
    		<dependency>
    			<groupId>org.projectlombok</groupId>
    			<artifactId>lombok</artifactId>
    			<optional>true</optional>
    		</dependency>
    		<!-- Spring Starter test -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-test</artifactId>
    			<scope>test</scope>
    		</dependency>
    		<!-- Spring starter data jpa -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-data-jpa</artifactId>
    		</dependency>
    		<!-- PostgreSQL -->
    		<dependency>
    			<groupId>org.postgresql</groupId>
    			<artifactId>postgresql</artifactId>
    			<scope>runtime</scope>
    		</dependency>
    		<!-- Swagger -->
    		<dependency>
    			<groupId>io.springfox</groupId>
    			<artifactId>springfox-boot-starter</artifactId>
    			<version>3.0.0</version>
    		</dependency>
    		<!-- HTTP Client -->
    		<dependency>
    			<groupId>org.apache.httpcomponents</groupId>
    			<artifactId>httpclient</artifactId>
    			<scope>test</scope>
    		</dependency>
    		<!-- jdbc -->
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-jdbc</artifactId>
    		</dependency>
    	</dependencies>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<version>3.8.1</version>
    				<configuration>
    					<source>${java.version}</source>
    					<target>${java.version}</target>
    				</configuration>
    			</plugin>
    		</plugins>
    	</build>
    </project>

  2. #2
    Membre confirmé Avatar de ruscov
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Mars 2007
    Messages
    347
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : Belgique

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mars 2007
    Messages : 347
    Points : 500
    Points
    500
    Par défaut
    je pense que c'est le nome de la properties du driver qui n'est pas bonne:

    spring.datasource.driverClassName=org.postgresql.Driver

    https://docs.spring.io/spring-boot/d...roperties.html
    Mes logiciels n’ont jamais de bug. Ils développent juste certaines fonctions aléatoires.

Discussions similaires

  1. [Data] Problème configuration datasource hibernate
    Par Clezio dans le forum Spring
    Réponses: 1
    Dernier message: 28/07/2011, 14h13
  2. [Data] Problème configuration datasource hibernate
    Par Clezio dans le forum Spring
    Réponses: 3
    Dernier message: 26/07/2011, 20h56
  3. Configuration dataSource dans Jetty 7
    Par robert.tari dans le forum Développement Web en Java
    Réponses: 1
    Dernier message: 18/08/2010, 11h11
  4. Réponses: 0
    Dernier message: 10/03/2009, 00h35
  5. configuration datasource JBoss
    Par n00noors dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 27/02/2006, 15h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo