问题描述
我正在尝试将 Glassfish 4.1.2 连接到下面给出的 MysqL 数据库版本。
MysqL Ver 15.1 distrib 10.2.36-MariaDB,for Linux (x86_64) using readline 5.1
我使用的是 Connector/J 版本 5.1.49
。
虽然我的配置看起来不错,但我已经尝试了 localhost/127.0.0.1 但 glassfish 无法获得连接。我在管理控制台上收到以下错误。
SYS_ERP_POOL 的 Ping 连接池失败。连接可以 未分配,因为:无法创建到数据库的连接 服务器。尝试重新连接 3 次。放弃。请检查 server.log 了解更多详情。
RAR8054: Exception while creating an unpooled [test] connection for pool [ SYS_ERP_POOL ],Connection Could not be allocated because: Could not create
connection to database server. Attempted reconnect 3 times. Giving up.]]
[2021-02-16T17:38:37.540+0000] [glassfish 4.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=42 _ThreadName=admin-listener(3)] [timeMillis: 1613497117540] [levelValue: 1000] [[
RestResponse.getResponse() gives FAILURE. endpoint = 'https://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=SYS_ERP_POOL}']]
我知道错误 8054
表示我的连接配置有问题,但是,我确信一切正常,因为 MysqL 在 localhost 上运行良好,并且绑定到 127.0.0.1
。我可以通过服务器上的本地命令行连接到它。我认为 Glassfish 也应该能够从 localhost 访问 sql 服务器,并且两者都在同一台服务器上。
我的配置:
URL: jdbc:MysqL://127.0.0.1:3306/SYS_ERP
Url: jdbc:MysqL://127.0.0.1:3306/SYS_ERP
ServerName: 127.0.0.1
Port: 3306
PortNumber: 3306
DatabaseName: SYS_ERP
注意:我也尝试用 localhost 替换 127.0.0.1,但没有成功。
# netstat -anp | grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 15459/MysqLd
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)