2
respostas

FORNECEDOR NÃO ENCONTRA O ARQUIVO DE CONFIGURAÇÃO DO CONFIG SERVER

Seguindo os mesmos códigos do curso e até ao baixar eles para buildar... o mesmo erro da no fornecedor, aparentemente a conexão com o config-server não está ocorrendo mesmo utilizando o bootstrap.

022-04-28 21:37:59.052  WARN 8532 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.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
2022-04-28 21:37:59.056  INFO 8532 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-04-28 21:37:59.111  INFO 8532 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-04-28 21:37:59.117 ERROR 8532 --- [           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).

Projeto Fornecedor:

Arquivo bootstrap:

spring:
  application:
    name: 'fornecedor'
  profiles:
    active: default
  cloud:
    config:
      uri: http://localhost:8888

Arquivo yaml properties


server:
  port: 8081

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8761/eureka

Projeto config-server:

Yaml properties:

server:
  port: 8888

spring:


  cloud:
    config:
      server:
        git:
          uri: https://github.com/felipegarciamf/microservices-repo
          search-paths:
          - fornecedor

pode me ajudar com isso, pois o material do curso não está funcionando corretamente.

2 respostas

Olá, já encontrei o problema...

No curso é passado para criar um arquivo yaml e colocar para fora, mas na hora não manda o spring.jpa apenas o jpa... ajustei e está funcionando.. muito obrigado.

Olá Silas, tudo bem com você?

Fico feliz que tenha conseguido solucionar o erro apresentado e além disso, compartilhado sua forma de resolução dentro da comunidade Alura, o que poderá ajudar outros estudantes que passem por problemas semelhantes. Continue mergulhando em conhecimento e não hesite em voltar ao fórum para continuar aprendendo e interagindo com a comunidade.

Abraços e bons estudos!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software