in Java

Spring +Struts + Hibernate + MySQL碰到的几个问题

小结

配置Spring +Struts + Hibernate + MySQL碰到的几个问题,并解决。

问题及解决

访问MySQL数据库的问题

返回错误:java.sql.SQLException: Access denied for user ‘root ‘@’localhost’ (using password: YES)

发现MySQL没有开放远程访问权限,解决:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';

对于MariaDB修改密码需要以下指令:

UPDATE user SET authentication_string=password('P@ssw0rd') WHERE user='root'

缺少jar包

返回错误:Caused by: Cannot locate the chosen ObjectFactory implementation: spring – [unknown location]

缺少struts2-spring-plugin-x.x.x.x.jar包,添加到工程里就行。

地址已经被占用

返回: java.net.BindException: Address already in use: JVM_Bind :80

需要找到进程,并关掉进程,就不会冲突了。

netstat -oan | find "80"
taskkill /F /PID xxxx

参考

Caused by: Cannot locate the chosen ObjectFactory implementation: spring – [unknown location]
java.net.BindException: Address already in use: JVM_Bind :80
MySQL Error: : ‘Access denied for user ‘root’@’localhost’