Невозможно получить соединение с источником данных (Hibernate + Hikari + MySQL) - PullRequest
0 голосов
/ 05 августа 2020

Я пытаюсь подключиться к локальной базе данных MySql, используя Hikari в качестве пула подключений, но не могу установить sh подключение.

Может ли кто-нибудь сказать мне, что я делаю неправильно ?

MySql Версия: mysql Версия 8.0.21 для Linux на x86_64 (MySQL Сервер сообщества - GPL)

Зависимости в следующие проекты:

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-hikaricp</artifactId>
            <version>5.3.6.Final</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.21</version>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>2.7.6</version>
        </dependency>

Журнал запуска HikariCP:

2020-08-04 19:09:31.089 DEBUG [main] [com.zaxxer.hikari.HikariConfig] chapuceros-pool - configuration:
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] allowPoolSuspension.............false
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] autoCommit......................true
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] catalog.........................none
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] connectionInitSql...............none
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] connectionTestQuery............."/* ping */"
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] connectionTimeout...............30000
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] dataSource......................none
2020-08-04 19:09:31.091 DEBUG [main] [com.zaxxer.hikari.HikariConfig] dataSourceClassName.............none
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] dataSourceJNDI..................none
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] dataSourceProperties............{autoReconnectForPools=true, cacheServerConfiguration=true, useServerPrepStmts=true, elideSetAutoCommits=true, user=chapucerodev, rewriteBatchedStatements=true, cachePrepStmts=true, cacheResultSetMetadata=true, useLocalSessionState=true, maintainTimeStats=false, prepStmtCacheSize=250, prepStmtCacheSqlLimit=2048, password=<masked>, useLocalTransactionState=true}
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] driverClassName................."com.mysql.cj.jdbc.Driver"
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] healthCheckProperties...........{}
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] healthCheckRegistry.............none
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] idleTimeout.....................90000
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] initializationFailFast..........true
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] initializationFailTimeout.......1
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] isolateInternalQueries..........false
2020-08-04 19:09:31.092 DEBUG [main] [com.zaxxer.hikari.HikariConfig] jdbc4ConnectionTest.............false
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] jdbcUrl.........................jdbc:mysql://localhost:3306/TEST_DB
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] leakDetectionThreshold..........0
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] maxLifetime.....................120000
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] maximumPoolSize.................30
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] metricRegistry..................none
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] metricsTrackerFactory...........none
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] minimumIdle.....................1
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] password........................<masked>
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] poolName........................"chapuceros-pool"
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] readOnly........................false
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] registerMbeans..................false
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] scheduledExecutor...............none
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] scheduledExecutorService........internal
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] schema..........................none
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] threadFactory...................internal
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] transactionIsolation............default
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] username........................"defaultuser"
2020-08-04 19:09:31.093 DEBUG [main] [com.zaxxer.hikari.HikariConfig] validationTimeout...............5000

Сводка ошибок:

[main] [com.zaxxer.hikari.HikariDataSource] chapuceros-pool - Starting...
[com.zaxxer.hikari.pool.PoolBase] chapuceros-pool - Failed to create/setup connection: Communications link failure
[com.zaxxer.hikari.pool.HikariPool] chapuceros-pool - Cannot acquire connection from data source
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

Caused by: java.net.SocketException: Broken pipe (Write failed)

1 Ответ

0 голосов
/ 07 августа 2020

Добавление параметра ?useSSL=false в jdbcUrl решило мою проблему.

...