De ce aplicația mea java nu se poate conecta la serverul meu mysql?
docker-compose.yml
versiunea: "3"
Servicii:
chiesulu:
#image: 523840521829.dkr.ecr.us-east-1.amazonaws.com/djammadev/chiesulu:latest
imagine: djammadev/chiesulu:latest
porturi:
- 9030:80
env_file:
- setenv.env
implementează:
replici: 1
update_config:
paralelism: 1
restart_policy:
stare: la eșec
volume:
db-data:
setenv.env
EBEAN_DATASOURCE=db
DATABASE_USERNAME=mysql-user
DATABASE_PASSWORD=parola-mysql-user
DATABASE_URL=jdbc:mysql://mysql-server.com/mydb?serverTimezone=UTC
DATABASE_DRIVER=com.mysql.cj.jdbc.Driver
Eroare
chiesulu_1 | io.ebean.datasource.DataSourceInitialiseException: Eroare la inițializarea DataSource cu utilizatorul: root url:jdbc:mysql://mysql-server.com/mydb?serverTimezone=UTC error:Nu s-a putut crea conexiunea la serverul bazei de date. S-a încercat reconectarea de 10 ori. Renunța.
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:250)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPoolFactory.createPool(ConnectionPoolFactory.java:14)
chiesulu_1 | la io.ebean.datasource.DataSourceFactory.create(DataSourceFactory.java:26)
chiesulu_1 | la io.ebeaninternal.server.core.InitDataSource.create(InitDataSource.java:121)
chiesulu_1 | la io.ebeaninternal.server.core.InitDataSource.createFromConfig(InitDataSource.java:116)
chiesulu_1 | la io.ebeaninternal.server.core.InitDataSource.initDataSource(InitDataSource.java:49)
chiesulu_1 | la io.ebeaninternal.server.core.InitDataSource.initialise(InitDataSource.java:34)
chiesulu_1 | la io.ebeaninternal.server.core.InitDataSource.init(InitDataSource.java:25)
chiesulu_1 | la io.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:229)
chiesulu_1 | la io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:90)
chiesulu_1 | la io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:63)
chiesulu_1 | la io.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:35)
chiesulu_1 | la io.ebean.DatabaseFactory.create(DatabaseFactory.java:63)
chiesulu_1 | la io.ebean.DbContext.getWithCreate(DbContext.java:105)
chiesulu_1 | la io.ebean.DbContext.<init>(DbContext.java:44)
chiesulu_1 | la io.ebean.DbContext.<clinit>(DbContext.java:24)
chiesulu_1 | la io.ebean.DB.<clinit>(DB.java:65)
chiesulu_1 | la io.ebean.Finder.db(Finder.java:123)
chiesulu_1 | la io.ebean.Finder.byId(Finder.java:154)
chiesulu_1 | la com.djammadev.chiesulu.resources.OwnershipResource.getConnected(OwnershipResource.java:41)
chiesulu_1 | la com.djammadev.chiesulu.resources.OwnershipResource.getBaseKey(OwnershipResource.java:112)
chiesulu_1 | la com.djammadev.chiesulu.resources.BandResource.getBaseKey(BandResource.java:51)
chiesulu_1 | la com.shinitech.djammadev.resources.BasicResource.buildKey(BasicResource.java:343)
chiesulu_1 | la com.shinitech.djammadev.resources.AbstractEntityResource.getAll(AbstractEntityResource.java:55)
chiesulu_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Metoda nativă)
chiesulu_1 | la sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
chiesulu_1 | la sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
chiesulu_1 | la java.lang.reflect.Method.invoke(Method.java:498)
chiesulu_1 | la org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
chiesulu_1 | la org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
chiesulu_1 | la org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
chiesulu_1 | la org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:243)
chiesulu_1 | la org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
chiesulu_1 | la org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
chiesulu_1 | la org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
chiesulu_1 | la org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
chiesulu_1 | la org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
chiesulu_1 | la org.glassfish.jersey.internal.Errors$1.call(Erori.java:272)
chiesulu_1 | la org.glassfish.jersey.internal.Errors$1.call(Erori.java:268)
chiesulu_1 | la org.glassfish.jersey.internal.Errors.process(Erori.java:316)
chiesulu_1 | la org.glassfish.jersey.internal.Errors.process(Erori.java:298)
chiesulu_1 | la org.glassfish.jersey.internal.Errors.process(Erori.java:268)
chiesulu_1 | la org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
chiesulu_1 | la org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
chiesulu_1 | la org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
chiesulu_1 | la org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
chiesulu_1 | la org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
chiesulu_1 | la org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
chiesulu_1 | la org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
chiesulu_1 | la org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
chiesulu_1 | la org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
chiesulu_1 | la org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
chiesulu_1 | la org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
chiesulu_1 | la org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
chiesulu_1 | la org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
chiesulu_1 | la org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
chiesulu_1 | la org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
chiesulu_1 | la org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
chiesulu_1 | la org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
chiesulu_1 | la org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
chiesulu_1 | la org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
chiesulu_1 | la org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
chiesulu_1 | la org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
chiesulu_1 | la org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
chiesulu_1 | la org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
chiesulu_1 | la org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589)
chiesulu_1 | la org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
chiesulu_1 | la java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
chiesulu_1 | la java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
chiesulu_1 | la org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
chiesulu_1 | la java.lang.Thread.run(Thread.java:748)
chiesulu_1 | Cauzat de: java.sql.SQLNonTransientConnectionException: Nu s-a putut crea conexiunea la serverul bazei de date. S-a încercat reconectarea de 10 ori. Renunța.
chiesulu_1 | la com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
chiesulu_1 | la com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
chiesulu_1 | la com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
chiesulu_1 | la com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
chiesulu_1 | la com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
chiesulu_1 | la com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:897)
chiesulu_1 | la com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:822)
chiesulu_1 | la com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)
chiesulu_1 | la com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)
chiesulu_1 | la com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
chiesulu_1 | la java.sql.DriverManager.getConnection(DriverManager.java:664)
chiesulu_1 | la java.sql.DriverManager.getConnection(DriverManager.java:208)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:543)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.createUnpooledConnection(ConnectionPool.java:538)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.createConnectionForQueue(ConnectionPool.java:757)
chiesulu_1 | la io.ebean.datasource.pool.PooledConnectionQueue.ensureMinimumConnections(PooledConnectionQueue.java:176)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.initialise(ConnectionPool.java:298)
chiesulu_1 | la io.ebean.datasource.pool.ConnectionPool.<init>(ConnectionPool.java:247)
chiesulu_1 | ... 70 de cadre comune omise
chiesulu_1 | Cauzat de: com.mysql.cj.exceptions.CJCommunicationsException: Eroare legătura de comunicații
chiesulu_1 |
chiesulu_1 | Ultimul pachet trimis cu succes la server a fost acum 0 milisecunde. Driverul nu a primit niciun pachet de la server.
chiesulu_1 | la sun.reflect.NativeConstructorAccessorImpl.newInstance0(Metoda nativă)
chiesulu_1 | la sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
chiesulu_1 | la sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
chiesulu_1 | la java.lang.reflect.Constructor.newInstance(Constructor.java:423)
chiesulu_1 | la com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
chiesulu_1 | la com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
chiesulu_1 | la com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
chiesulu_1 | la com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:340)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348)
chiesulu_1 | la com.mysql.cj.NativeSession.connect(NativeSession.java:163)
chiesulu_1 | la com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:841)
chiesulu_1 | ... 82 de cadre comune omise
chiesulu_1 | Cauzat de: javax.net.ssl.SSLHandshakeException: Niciun protocol adecvat (protocolul este dezactivat sau suitele de criptare sunt inadecvate)
chiesulu_1 | la sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
chiesulu_1 | la sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103)
chiesulu_1 | la sun.security.ssl.TransportContext.kickstart(TransportContext.java:220)
chiesulu_1 | la sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:428)
chiesulu_1 | la com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316)
chiesulu_1 | la com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
chiesulu_1 | la com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:331)
chiesulu_1 | ... 88 de cadre comune omise
chiesulu_1 | 25 octombrie 2021 12:23:07 org.apache.catalina.core.StandardWrapperValve invocare
chiesulu_1 | SEVER: Servlet.service() pentru servlet [ChiesuluApplication] în context cu calea [] a aruncat excepția [org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError] cu cauza principală