JuyeoungJun / cron-monitoring

for cron-monitoring
0 stars 0 forks source link

배포 이미지 MYSQL 미연결 현상 #69

Closed JuyeoungJun closed 3 years ago

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 8, 2021, 09:46

개요

배포상 이미지에서 mysql 연결 실패

버그 내용

2021-07-07 07:55:07.672 ERROR 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2021-07-07 07:55:07.673  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2021-07-07 07:55:07.684  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-07-07 07:55:07.709  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-07-07 07:55:07.738 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

버그 재현 코드

spring:
  config:
    activate:
      on-profile: "prod_env"
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: ENC(FT9MAa2OjCi3L4KxLTtuihNe7aaTI+MqU7BqleHlSm37pH/jCsc6kfPLgp0XrR+IhfZvnVMlBz0tsueSbnsMlOC+XgPAUnGAhw8b8BgcqUotG++IpcKRCnqzkJPGp4O3G8CglAb5c18=)

해결 방안

spring:
  config:
    activate:
      on-profile: "prod_env"
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: ENC(grsR77SEhN7kmgtfZg7KbctEBHpLc/jA4pLSIrBXErbDc66kd0glUpfwR/4j9SK+91evde+5yCycfYe4wlGJq7tFw2vUm80TjNV+qinr1wP5uJqdx77In475nhw/qy2x)

추후 고려사항

JuyeoungJun commented 3 years ago

In GitLab by @gm2202981 on Jul 8, 2021, 09:49

mentioned in merge request !46