인프런 커뮤니티 질문&답변

작성자 없음

작성자 정보가 삭제된 글입니다.

자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]

45강 dev 연결 에러

작성

·

232

0

java -jar build/libs/library-app-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev

 

2024-03-06 06:57:53.124 ERROR 3375 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]

2024-03-06 06:34:35.506 WARN 24251 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

2024-03-06 06:57:53.140 ERROR 3375 --- [ main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

2024-03-06 06:57:53.140 WARN 3375 --- [ 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]

2024-03-06 06:57:53.152 INFO 3375 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

2024-03-06 06:57:53.185 INFO 3375 --- [ main] ConditionEvaluationReportLoggingListener :

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

2024-03-06 06:57:53.233 ERROR 3375 --- [ main] o.s.boot.SpringApplication : Application run failed

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]

 

 

 

 

제 컴퓨터 mysql로 연결되어서 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 이런 에러가 나온 것 같은데 AWS에서 빌린 컴퓨터에서 mysql연결하려면 어떻게 해야하나요?

아니면 제 컴퓨터 mysql로 연결하고 진행하나요?

답변 1

0

최태현님의 프로필 이미지
최태현
지식공유자

안녕하세요! alien22님! 🙂

질문 주셔서 감사합니다.

 

보다 정확한 것은 application.yml 설정을 확인해 보아야 알 수 있을 것 같은데요!

우선 AWS에서는 AWS에 설치되어 있는 DB에 연결하는 것이 맞아요! 그래서 profile 이란 것을 활용해 각자의 컴퓨터 (local 환경) 과 AWS 컴퓨터에서 각각 다른 DB에 접근할 수 있도록 하는것이고요! 👍

AWS에서 우리컴퓨터로 연결하는 경우는 거의 없습니다! (반대로 우리 컴퓨터에서 AWS로 연결하는 경우는 꽤 있어요)

 

설정이 잘 되어 있는지 application.yml 을 확인해보시고, AWS에서도 DB가 잘 켜져 있는지 확인해보시면 될 것 같습니다.

답변이 도움이 되었으면 좋겠습니다. 감사합니다! 🙏

작성자 없음

작성자 정보가 삭제된 글입니다.

질문하기