JavaEE学习---JDBC-连接池异常

本文详细介绍了如何解决在GlassFish服务器上出现的MySQL连接池错误,包括错误信息、可能的原因及具体的解决步骤,如正确配置JDBC驱动和路径。

问题描述:
在这里插入图片描述
An error has occurred
Ping Connection Pool failed for MySQL. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource Please check the server.log for more details.

在这里插入图片描述

警告: RAR8054: Exception while creating an unpooled [test] connection for pool [ MySQL ], Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
严重: RestResponse.getResponse() gives FAILURE. endpoint = ‘http://localhost:4848/management/domain/resources/ping-connection-pool.json’; attrs = ‘{id=MySQL}’

解决方案:(设置完记得重启服务器)
1.将JDBC拷贝到glassfish的安装目录下
D:\glassfish-4.0\glassfish4\glassfish\domains\domain1\lib
D:\glassfish-4.0\glassfish4\glassfish\domains\domain1\lib\ext
D:\glassfish-4.0\glassfish4\glassfish\lib
2.驱动程序名称错误:(依靠这个方法成功解决了问题)
JDBC版本8,请尝试
com.mysql.cj.jdbc.MysqlConnectionPoolDataSource
对于较老的版本,请尝试
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
在这里插入图片描述

成功截图:
成功解决啦
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值