问题描述:
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
成功截图:
成功解决啦