docker-compose spring boot cannot connect to mysql
docker-compose spring boot cannot connect to mysql
当我只包含MySQL的docker-compose文件并且在Intellij或.jar文件中运行应用程序时,它可以正常工作,但是当我尝试使用docker compose运行时,我遇到了以下错误:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
我的dockerfile文件:
FROM adoptopenjdk/openjdk13 ADD ./build/libs/AppointmentsSystem-0.0.1-SNAPSHOT.jar app.jar ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
我的docker-compose.yml文件:
version: "3"
services:
app:
build:
dockerfile: Dockerfile
context: .
ports:
- 8081:8081
depends_on:
- mysql
mysql:
image: mysql:5.7
volumes:
- ./mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: appointmentSystem
ports:
- 3308:3306
build.gradle文件:
plugins { id 'org.springframework.boot' version '2.2.1.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' id 'java' } group = 'com.sulimanLab' version = '0.0.1-SNAPSHOT' sourceCompatibility = '13' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } wrapper { gradleVersion = "6.0" } dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa' compile group: 'mysql', name: 'mysql-connector-java' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } testImplementation 'io.projectreactor:reactor-test' } test { useJUnitPlatform() }
还有application.yml文件:
spring:
datasource:
url: jdbc:mysql://localhost:3308/appointmentSystem
username: root
password: rootpassword
jpa:
database-platform: org.hibernate.dialect.MySQL5Dialect
database: MYSQL
hibernate:
ddl-auto: update
server:
port: 8081
错误信息:
PS C:\Users\user\Desktop\Github\AppointmentsSystem - Copy> docker-compose.exe up Creating network "appointmentssystem-copy_default" with the default driver Creating appointmentssystem-copy_mysql_1 ... done Creating appointmentssystem-copy_app_1 ... done Attaching to appointmentssystem-copy_mysql_1, appointmentssystem-copy_app_1 mysql_1 | 2020-01-05 17:05:10+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started. mysql_1 | 2020-01-05 17:05:10+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' mysql_1 | 2020-01-05 17:05:10+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started. mysql_1 | 2020-01-05T17:05:11.307944Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2020-01-05T17:05:11.313597Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 1 ... mysql_1 | 2020-01-05T17:05:11.321895Z 0 [Note] InnoDB: PUNCH HOLE support available mysql_1 | 2020-01-05T17:05:11.321911Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mysql_1 | 2020-01-05T17:05:11.321914Z 0 [Note] InnoDB: Uses event mutexes mysql_1 | 2020-01-05T17:05:11.321916Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier mysql_1 | 2020-01-05T17:05:11.321919Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 mysql_1 | 2020-01-05T17:05:11.321921Z 0 [Note] InnoDB: Using Linux native AIO mysql_1 | 2020-01-05T17:05:11.322089Z 0 [Note] InnoDB: Number of pools: 1 mysql_1 | 2020-01-05T17:05:11.322160Z 0 [Note] InnoDB: Using CPU crc32 instructions mysql_1 | 2020-01-05T17:05:11.323705Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M mysql_1 | 2020-01-05T17:05:11.349344Z 0 [Note] InnoDB: Completed initialization of buffer pool mysql_1 | 2020-01-05T17:05:11.351768Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mysql_1 | 2020-01-05T17:05:11.420065Z 0 [Note] InnoDB: Highest supported file format is Barracuda. mysql_1 | 2020-01-05T17:05:11.525183Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables mysql_1 | 2020-01-05T17:05:11.527734Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mysql_1 | 2020-01-05T17:05:11.735100Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mysql_1 | 2020-01-05T17:05:11.744572Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. mysql_1 | 2020-01-05T17:05:11.744744Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. mysql_1 | 2020-01-05T17:05:11.745330Z 0 [Note] InnoDB: Waiting for purge to start mysql_1 | 2020-01-05T17:05:11.796296Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 12442260 mysql_1 | 2020-01-05T17:05:11.796835Z 0 [Note] Plugin 'FEDERATED' is disabled. mysql_1 | 2020-01-05T17:05:11.797225Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mysql_1 | 2020-01-05T17:05:11.878505Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. mysql_1 | 2020-01-05T17:05:11.878712Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. mysql_1 | 2020-01-05T17:05:11.898316Z 0 [Warning] CA certificate ca.pem is self signed. mysql_1 | 2020-01-05T17:05:11.900205Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. mysql_1 | 2020-01-05T17:05:11.910728Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 mysql_1 | 2020-01-05T17:05:11.911146Z 0 [Note] IPv6 is available. mysql_1 | 2020-01-05T17:05:11.911674Z 0 [Note] - '::' resolves to '::'; mysql_1 | 2020-01-05T17:05:11.912095Z 0 [Note] Server socket created on IP: '::'. mysql_1 | 2020-01-05T17:05:11.917607Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. mysql_1 | 2020-01-05T17:05:11.947376Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200105 17:05:11 mysql_1 | 2020-01-05T17:05:12.631614Z 0 [Note] Event Scheduler: Loaded 0 events mysql_1 | 2020-01-05T17:05:12.632095Z 0 [Note] mysqld: ready for connections. mysql_1 | Version: '5.7.28' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) app_1 | app_1 | . ____ _ __ _ _ app_1 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ app_1 | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ app_1 | \\/ ___)| |_)| | | | | || (_| | ) ) ) ) app_1 | ' |____| .__|_| |_|_| |_\__, | / / / / app_1 | =========|_|==============|___/=/_/_/_/ app_1 | :: Spring Boot :: (v2.2.1.RELEASE) app_1 | app_1 | 2020-01-05 17:05:13.641 INFO 1 --- [ main] c.s.A.AppointmentsSystemApplication : Starting AppointmentsSystemApplication on 185f7c998f26 with PID 1 (/app.jar started by root in /) app_1 | 2020-01-05 17:05:13.660 INFO 1 --- [ main] c.s.A.AppointmentsSystemApplication : No active profile set, falling back to default profiles: default app_1 | 2020-01-05 17:05:14.985 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode. app_1 | 2020-01-05 17:05:15.132 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 131ms. Found 5 repository interfaces. app_1 | 2020-01-05 17:05:15.844 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) app_1 | 2020-01-05 17:05:16.390 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http) app_1 | 2020-01-05 17:05:16.416 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] app_1 | 2020-01-05 17:05:16.417 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27] app_1 | 2020-01-05 17:05:16.533 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext app_1 | 2020-01-05 17:05:16.533 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2786 ms app_1 | 2020-01-05 17:05:17.203 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] app_1 | 2020-01-05 17:05:17.317 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.8.Final} app_1 | 2020-01-05 17:05:17.565 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} app_1 | 2020-01-05 17:05:17.807 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... app_1 | 2020-01-05 17:05:18.033 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization. app_1 | app_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure app_1 | app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. app_1 | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.pool.HikariPool. (HikariPool.java:115) ~[HikariCP-3.4.1.jar!/:na] app_1 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.1.jar!/:na] app_1 | at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.boot.internal.InFlightMetadataCollectorImpl. (InFlightMetadataCollectorImpl.java:175) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1214) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1245) ~[hibernate-core-5.4.8.Final.jar!/:5.4.8.Final] app_1 | at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391) ~[spring-orm-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378) ~[spring-orm-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.1.RELEASE.jar!/:5.2.1.RELEASE] app_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.1.RELEASE.jar!/:2.2.1.RELEASE] app_1 | at com.sulimanLab.AppointmentsSystem.AppointmentsSystemApplication.main(AppointmentsSystemApplication.java:10) ~[classes!/:na] app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] app_1 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] app_1 | at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na] app_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[app.jar:na] app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[app.jar:na] app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[app.jar:na] app_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[app.jar:na] app_1 | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure app_1 | app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. app_1 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na] app_1 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na] app_1 | at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na] app_1 | at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[na:na] app_1 | at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[na:na] app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | ... 57 common frames omitted app_1 | Caused by: java.net.ConnectException: Connection refused app_1 | at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na] app_1 | at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:579) ~[na:na] app_1 | at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542) ~[na:na] app_1 | at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[na:na] app_1 | at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:339) ~[na:na] app_1 | at java.base/java.net.Socket.connect(Socket.java:585) ~[na:na] app_1 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65) ~[mysql-connector-java-8.0.18.jar!/:8.0.18] app_1 | ... 60 common frames omitted app_1 | app_1 | 2020-01-05 17:05:18.035 WARN 1 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : Communications link failure app_1 | app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. app_1 | 2020-01-05 17:05:18.068 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect app_1 | 2020-01-05 17:05:19.454 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... app_1 | 2020-01-05 17:05:19.462 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization. app_1 | app_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure