Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resour

搭建ssm框架练习,系统启动不起来

问题:事务管理器读不到mysql的数据源

解决:设置idea的警告级别,调到最低,如图

Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resour_第1张图片

问题:运行时报错(问题的先后忘了,差不多就是这三个):

Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resour

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password)
Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException……

解决:

(1)修改mysql的最大连接数;

查看最大连接数:

show variables like '%max_connections%'

修改最大连接数据:

set global max_connections=1000

启动项目还是有错,┭┮﹏┭┮,继续改;

(2)修改jdbc.properties

jdbc.url=jdbc:mysql://localhost:3306/ssm

改为:jdbc.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true

启动项目还是有错,┭┮﹏┭┮,继续改;

(3)换jdbc的驱动jar包

查看mysql版本命令:show variables like '%version%'

换成mysql-connector-java-5.1.25-bin.jar

下载地址:https://downloads.mysql.com/archives/c-j/;

Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resour_第2张图片

启动项目还是有错,┭┮﹏┭┮,继续改;

(4)mysql的操作:本意是验证MySQL的账号密码,结果……

        (4.1)dos命令 net start mysql 提示服务名无效

            解决:在服务里找到mysql的服务名为mysql57

        (4.2)net start mysql57 发生系统错误5

            解决:权限不足,管理员权限打开cmd

      (4.3)mysql -hlocalhost -uroot -p mysql不是内部命令

            解决:环境变量path没有配置mysql的路径,查看mysql的安装路径:show variables like '%basedir%';,在path里写到bin

结果证明是jdbc.properties里 jdbc.password写错了,因为一直以来密码都是123456,结果新安装的MySQL数据库的密码设置成了root,所以一直也没考虑过密码的问题,看了一上午,压根没考虑过密码的问题!!!jdbc配置文件修改后,项目正常

 

 

你可能感兴趣的:(Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resour)