- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个微服务架构,每个微服务都有自己的 mysql 数据库。该应用程序在 IDE 中运行良好,但我在部署它时遇到问题,因为我无法将 mysql 数据库绑定(bind)到游戏微服务。我收到通信链路故障。堆栈跟踪如下。
docker-compose.yml
version: '3'
services:
# Database
game-mysql-db:
image: mysql:5.7
container_name: game-mysql-db
hostname: mysql-game
restart: always
environment:
MYSQL_DATABASE: 'boardify_game_development'
MYSQL_USER: 'Boardify'
MYSQL_PASSWORD: 'boardify'
MYSQL_ROOT_PASSWORD: 'password'
ports:
- "3306:3306"
expose:
- "3306"
networks:
- boardify-app-network
# Core services
service-discovery:
hostname: service-discovery
image: eureka-server
container_name: service-discovery
restart: always
ports:
- "8761:8761"
networks:
- boardify-app-network
boardify-game-service:
build:
context: ./game
args:
JAR_FILE: game-0.0.1-SNAPSHOT.jar
dockerfile: Dockerfile
image: game
container_name: boardify-game-service
hostname: boardify-game-service
ports:
- "8083:8083"
networks:
- boardify-app-network
environment:
- SERVER_PORT=8083
- EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://service-discovery:8761/eureka
- SPRING_PROFILES_ACTIVE=production
- SPRING_DATASOURCE_URL:jdbc:mysql://game-mysql-db:3306/boardify_game_development
depends_on:
- game-mysql-db
networks:
boardify-app-network:
driver: bridge
应用程序生产.properties
#tomcat properties
server.port=8083
#logging file properties
logging.file.path=./logs
logging.file.name=${logging.file.path}/game.log
#application properties
spring.application.name=game-service
#liquibase properties
#database properties
spring.datasource.url=@game.db.url@
spring.datasource.driver-class-name=@db.driverClassName@
spring.datasource.username=@db.username@
spring.datasource.password=@db.password@
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
#jpa properties
# Show or not log for each sql query
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=@sql.dialect@
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.registry-fetch-interval-seconds=30
eureka.instance.prefer-ip-address=true
eureka.instance.lease-renewal-interval-in-seconds=30
eureka.instance.lease-expiration-duration-in-seconds=60
security.jwt.url=/authenticate/login
security.jwt.header=Authorization
security.jwt.header.prefix=Bearer
security.jwt.expiration=1800000
security.jwt.secret=securitysecret23992_2332
eureka.client.service-url.defaultZone = http://service-discovery:8761/eureka
设置.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>production</id>
<activation>
<property>
<name>env</name>
<value>prod</value>
</property>
</activation>
<properties>
<game.db.url>jdbc:mysql://game-mysql-db:3306/boardify_game_development</game.db.url>
<db.driverClassName>com.mysql.jdbc.Driver</db.driverClassName>
<sql.dialect>org.hibernate.dialect.MySQL5Dialect</sql.dialect>
</properties>
</profile>
</profiles>
</settings>
堆栈跟踪:
boardify-game-service | 2020-05-17 08:19:40.932 WARN 1 --- [ main] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct ins
tantiation.
boardify-game-service | 2020-05-17 08:19:42.164 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
boardify-game-service |
boardify-game-service | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.HikariDataSource$$FastClassBySpringCGLIB$$eeb1ae86.invoke(<generated>) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) [spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at com.zaxxer.hikari.HikariDataSource$$EnhancerBySpringCGLIB$$20e93c44.getConnection(<generated>) [HikariCP-3.4.1.jar!/:na]
boardify-game-service | at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:311) [liquibase-core-3.8.0.jar!/:na]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.R
ELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELE
ASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE
]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE
]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at boardify.game.GameApplication.main(GameApplication.java:12) ~[classes!/:0.0.1-SNAPSHOT]
boardify-game-service | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
boardify-game-service | at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
boardify-game-service | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[game.jar:0.0.1-SNAPSHOT]
boardify-game-service | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_212]
boardify-game-service | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_212]
boardify-game-service | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | ... 50 common frames omitted
boardify-game-service | Caused by: java.net.ConnectException: Connection refused (Connection refused)
boardify-game-service | at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_212]
boardify-game-service | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_212]
boardify-game-service | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_212]
boardify-game-service | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_212]
boardify-game-service | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_212]
boardify-game-service | at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_212]
boardify-game-service | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | ... 53 common frames omitted
boardify-game-service |
boardify-game-service | 2020-05-17 08:19:42.186 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springf
ramework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguratio
n.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | 2020-05-17 08:19:42.210 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
boardify-game-service | 2020-05-17 08:19:42.429 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
boardify-game-service |
boardify-game-service | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
boardify-game-service | 2020-05-17 08:19:42.467 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
boardify-game-service |
boardify-game-service | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseA
utoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link fa
ilure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1803) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.REL
EASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEAS
E]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE
]
boardify-game-service | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
boardify-game-service | at boardify.game.GameApplication.main(GameApplication.java:12) [classes!/:0.0.1-SNAPSHOT]
boardify-game-service | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
boardify-game-service | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
boardify-game-service | at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
boardify-game-service | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [game.jar:0.0.1-SNAPSHOT]
boardify-game-service | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [game.jar:0.0.1-SNAPSHOT]
boardify-game-service | Caused by: liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:316) ~[liquibase-core-3.8.0.jar!/:na]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.
RELEASE]
boardify-game-service | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) ~[spring-beans-5.2.0.RELEASE.jar!/:5.2.0.REL
EASE]
boardify-game-service | ... 26 common frames omitted
boardify-game-service | Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
boardify-game-service |
boardify-game-service | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
boardify-game-service | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.18.jar!/:8.0.18]
boardify-game-service | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at com.zaxxer.hikari.HikariDataSource$$FastClassBySpringCGLIB$$eeb1ae86.invoke(<generated>) ~[HikariCP-3.4.1.jar!/:na]
boardify-game-service | at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service | at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
boardify-game-service exited with code 1
service-discovery | 2020-05-17 08:19
最佳答案
经过整整一周的痛苦研究这个问题,我意外地解决了这个问题。我在游戏环境(docker-compose)中添加了这 3 行代码。
- spring.liquibase.url=jdbc:mysql://game-mysql-db:3306/boardify_game_development
- spring.liquibase.user=Boardify
- spring.liquibase.password=boardify
我只为 spring_datasource_url 设置了 url。我在 application.properties 中设置它们,但看起来我必须在环境中设置它们。
关于java - 通信链路失败 : Spring boot, MySQL、Docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61849035/
我尝试阅读有关 Spring BOM、Spring Boot 和 Spring IO 的文档。 但是没有说明,我们应该如何一起使用它们? 在我的项目中,我们已经有了自己的 Parent POM ,所以
我正在开发的很酷的企业应用程序正在转向 Spring。这对所有团队来说都是非常酷和令人兴奋的练习,但也是一个巨大的压力源。我们所做的是逐渐将遗留组件移至 Spring 上下文。现在我们有一个 huuu
我正在尝试使用 @Scheduled 运行 Spring 批处理作业注释如下: @Scheduled(cron = "* * * * * ?") public void launchMessageDi
我对这两个概念有点困惑。阅读 Spring 文档,我发现,例如。 bean 工厂是 Spring 容器。我还读到“ApplicationContext 是 BeanFactory 的完整超集”。但两者
我们有一个使用 Spring BlazeDS 集成的应用程序。到目前为止,我们一直在使用 Spring 和 Flex,它运行良好。我们现在还需要添加一些 Spring MVC Controller 。
假设我有一个类(class) Person带属性name和 age ,它可以像这样用 Spring 配置: 我想要一个自定义的 Spring 模式元素,这很容易做到,允许我在我的 Sp
如何在 Java 中以编程方式使用 Spring Data 创建 MongoDB 复合索引? 使用 MongoTemplate 我可以创建一个这样的索引:mongoTemplate.indexOps(
我想使用 spring-complex-task 执行我的应用程序,并且我已经构建了复杂的 spring-batch Flow Jobs,它执行得非常好。 你能解释一下spring批处理流作业与spr
我实现了 spring-boot 应用程序,现在我想将它用作非 spring 应用程序的库。 如何初始化 lib 类,以便 Autowiring 的依赖项按预期工作?显然,如果我使用“new”创建类实
我刚开始学习 spring cloud security,我有一个基本问题。它与 Spring Security 有何不同?我们是否需要在 spring boot 上构建我们的应用程序才能使用 spr
有很多人建议我使用 Spring Boot 而不是 Spring 来开发 REST Web 服务。我想知道这两者到底有什么区别? 最佳答案 总之 Spring Boot 减少了编写大量配置和样板代码的
您能向我解释一下如何使用 Spring 正确构建 Web 应用程序吗?我知道 Spring 框架的最新版本是 4.0.0.RELEASE,但是 Spring Security 的最新版本是 3.2.0
我如何才能知道作为 Spring Boot 应用程序的一部分加载的所有 bean 的名称?我想在 main 方法中有一些代码来打印服务器启动后加载的 bean 的详细信息。 最佳答案 如spring-
我有一个使用 Spring 3.1 构建的 RESTful API,也使用 Spring Security。我有一个 Web 应用程序,也是一个 Spring 3.1 MVC 应用程序。我计划让移动客
升级到 Spring 5 后,我在 Spring Rabbit 和 Spring AMQP 中遇到错误。 两者现在都设置为 1.5.6.RELEASE 有谁知道哪些版本应该与 Spring 5 兼容?
我现在已经使用 Spring Framework 3.0.5 和 Spring Security 3.0.5 多次了。我知道Spring框架使用DI和AOP。我还知道 Spring Security
我收到错误 Unable to Location NamespaceHandler when using context:annotation-config running (java -jar) 由
在 Spring 应用程序中嵌入唯一版本号的策略是什么? 我有一个使用 Spring Boot 和 Spring Web 的应用程序。 它已经足够成熟,我想对其进行版本控制并在运行时看到它显示在屏幕上
我正在使用 spring data jpa 进行持久化。如果存在多个具有相同名称的实体,是否有一种方法可以将一个实体标记为默认值。类似@Primary注解的东西用来解决多个bean的依赖问题 @Ent
我阅读了 Spring 框架的 DAOSupport 类。但是我无法理解这些 DAOSuport 类的优点。在 DAOSupport 类中,我们调用 getXXXTemplate() 方法来获取特定的
我是一名优秀的程序员,十分优秀!