0

i am trying to put a spring boot application inside a docker container but when i run it i get this error. i am seeing that it is the application.properties of hiraki

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v2.3.1.RELEASE)


2022-04-13 17:21:59.930  INFO 1 --- [           main] com.classicowines.survey.ClassicoWines   : No active profile set, falling back to default profiles: default

2022-04-13 17:22:01.574  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2022-04-13 17:22:02.164  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 573ms. Found 19 JPA repository interfaces.

2022-04-13 17:22:03.091  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=86bffc71-aaf5-31b9-a9ba-6946fcbcc005

2022-04-13 17:22:04.309  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)

2022-04-13 17:22:04.331  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2022-04-13 17:22:04.332  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.36]

2022-04-13 17:22:04.441  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

2022-04-13 17:22:04.442  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4450 ms

2022-04-13 17:22:04.589  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$JpaInvokerConfiguration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; 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

2022-04-13 17:22:04.593  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

2022-04-13 17:22:04.628  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2022-04-13 17:22:04.634 ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    

this doesn't seem to work that I hid in another publication Spring Boot: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <exclusions>
        <exclusion>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat-jdbc</artifactId>
    <version>9.0.10</version>
</dependency>

this is my propesties


spring.datasource.type=com.zaxxer.hikari.HikariDataSource

# configuracion del jpa
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL82Dialect
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.show-sql=true


# HikariCP config - spring.datasource.hikari.*
spring.datasource.hikari.pool-name=pool-hikari-classico
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.connection-timeout=60000

dockerfile

FROM openjdk:8-jdk-alpine
COPY "./target/MS_ClassicoWinesSurvey-0.0.1-SNAPSHOT.jar" "app.jar"
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]
alexis
  • 1
  • 2

1 Answers1

-1

first point I received this project to be put in a docker, second when I checked the structure where the configuration files should be hosted they were not there.

when I checked the jar file the application.properties and logback.xml files were not found so it didn't work, I just added them in the datasource folder and it worked I also had to specify in the application.properties file the logback as logging.config=classpath:logback.xml

alexis
  • 1
  • 2