简体   繁体   English

Mysql 谷歌云中的实例 - 通信链路故障

[英]Mysql Instance in google cloud - Communications link failure

I am getting the following error while connecting to the MySql instance in google cloud.连接到谷歌云中的 MySql 实例时出现以下错误。

The connection to the database is over a private IP.通过私有 IP 连接到数据库。

The same setup is working on a normal co-located server.相同的设置在普通的共存服务器上工作。

I am able to use the mysql client to connect to the database over the private IP.我可以使用 mysql 客户端通过私有 IP 连接到数据库。

The application being deployed is a Spring based application.正在部署的应用程序是基于 Spring 的应用程序。

2020-07-30 09:31:03,369 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: java:jboss/datasources/ACADEMY: javax.resource.ResourceException: IJ031084: Unable to create connection at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345) at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352) at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.Z9764DC122B 2020-07-30 09:31:03,369 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: java:jboss/datasources/ACADEMY: javax.resource .ResourceException: IJ031084: Unable to create connection at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345) at org. jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352) at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final/ /org.Z9764DC122B E894C72F6314703587F596Z.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287) at org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1322) at org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.fillTo(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1142) at org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.Z E894C72F6314703587F596Z.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287) at org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp. SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1322) at org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.fillTo(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1142)在 org.jboss.ironjacamar.impl@1.4.22.Final//org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.Z 93F725A07423FE1C889F448B33D21F46Z:97) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 93F725A07423FE1C889F448B33D21F46Z:97) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago.最后一个成功发送到服务器的数据包是 0 毫秒前。 The driver has not received any packets from the server.驱动程序没有收到来自服务器的任何数据包。 at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) at com.mysql@8.0.20//com.mysql.cj.Z84BEFFD3A0D49636A58CE6080C at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions. SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) at com.mysql@8.0.20//com. mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) at com.mysql@8.0.20//com.mysql.cj.Z84BEFFD3A0D49636A58CE6080C AA87C7Z.ConnectionImpl.getInstance(ConnectionImpl.java:246) at com.mysql@8.0.20//com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)... 6 more Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure AA87C7Z.ConnectionImpl.getInstance(ConnectionImpl.java:246) at com.mysql@8.0.20//com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) at org.jboss.ironjacamar.jdbcadapters@1.4 .22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)... 6 more Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

You need to use the JDBC socket factory .您需要使用JDBC 插座工厂 You also need to enable Cloud SQL Admin API in the project, and install / authenticate the Cloud SDK before using the socket factory.您还需要在项目中启用 Cloud SQL Admin API,并在使用套接字工厂之前安装/验证 Cloud SDK。 Follow the instruction in the link above to add the library as a dependency and to create a JDBC URL按照上面链接中的说明将库添加为依赖项并创建 JDBC URL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM