Spring4+Struts2+Hibernate5报错:Access denied for user 'root'@'localhost' (using password: YES)

来源:互联网 发布:ubuntu 16.04卸载qq 编辑:程序博客网 时间:2024/04/30 08:10

输入用户名、密码后报错,原因为:

配置文件applicationContext.xml中

<bean id="datasource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="username" value="${jdbc.username}"></property>
<property name="password"value="{jdbc.password}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="driverClassName" value="${jdbc.driver}"></property>
</bean>

value忘记输入$符号!


具体报错信息如下:

Struts Problem Report

Struts has detected an unhandled exception:

Messages:
  1. Access denied for user 'root'@'localhost' (using password: YES)
  2. Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
  3. Unable to acquire JDBC Connection
  4. Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection 

0 0