У меня есть приложение Java, которое использует docker -compose. У меня MySQL база данных, подключенная с помощью docker -compose.
Когда я запускаю свое приложение на docker CMD: docker-compose up --build
, все прекрасно работает ! Но через ~ 24 часа я получаю исключение, как показано ниже . Подскажите пожалуйста, в чем может быть проблема?
docker_application | com.mysql.cj.exceptions.CJException: Access denied for user 'root'@'172.22.0.1' (using password: YES)
docker_application | at sun.reflect.GeneratedConstructorAccessor98.newInstance(Unknown Source) ~[na:na]
docker_application | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_212]
docker_application | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_212]
docker_application | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:816) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:741) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:709) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:132) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:540) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1452) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.NativeSession.connect(NativeSession.java:165) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:849) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:830) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker_application | at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
docker -составить:
dictionary_app_prod_mysql:
container_name: dictionary_app_prod_mysql
image: mysql:5.7
volumes:
- "mysql-data:/var/lib/mysql"
- "mysql-log:/var/log/mysql"
- "mysql-conf:/etc/mysql/conf.d"
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "general"
MYSQL_USER: "root"
MYSQL_PASSWORD: "root"
application.properties:
spring.datasource.url: jdbc:mysql://dictionary_app_prod_mysql:3306/general?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=10