连接aws rds mysql示例时获取com.mysql.cj.jdbc.exceptions.communicationsexception:通信链接失败

mkh04yzy  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(362)

当连接到一个aws-rds-mysql示例时,我得到以下错误。
只有当我在同一个tomcat示例上部署两个不同的war时,才会发生这种情况。两个应用程序都连接到相应的数据库示例(单独的数据库)。
如果我把它们分开部署,我就没有问题了。
错误如下:

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

27-Jul-2018 18:31:06.214 SEVERE [pool-27-thread-3] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool.
 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:741)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:57)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1663)
    at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:662)
    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:221)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:307)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:728)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:662)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:480)
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102)
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126)
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题