com.mchange.v2.resourcepool.BasicResourcePool
警告: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5df68463 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at
com.mchange.v2.resourcepool.BasicResourcePool
警告: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@45637a33 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
java.sql.SQLException:
Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
c3p0-config.xml代码:
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
c3p0-config
>
<
default-config
>
<
property
name
=
"driverClass"
>
com.mysql.jdbc.Driver
property
>
<
property
name
=
"jdbcUrl"
>
jdbc:mysql://localhost:3306/Estore
property
>
<
property
name
=
"user"
>
estore
property
>
<
property
name
=
"password"
>
estore
property
>
default-config
>
原因:(1)很有可能c3p0-config.xml中的配置文件出现问题,比如我是因为把“driverClass”不小心写成了“driver”,
所以在书写c3p0-config.xml要特别小心,可能多一个空格或者格式稍有问题,都会报以上错误。
如:驱动类写错、jdbcUrl格式错误等等。
解决之策:仔细检查书写是否正确!!!
(2)没有将mysql-connector-java-****-bin.jar包加入到Java运行环境的外部jar包的存放的位置。
解决之策:
在JAVA_HOME目录下的
jre\lib\ext文件下
(如E:\jdk8\jre\lib\ext)放置一个
连接MySQL数据库的jar包mysql-
connector-java-****-bin.jar
(3)还有一个也就是字面意思:你没有适用的驱动。
解决之策:检查是否在WebRoot\WEB-INF\lib目录下是否导入了合适的
mysql-connector-java-****-bin.jar包,没有则导入再重启服务器即可。
如有错误,欢迎指正!谢谢!