警告:org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL错误: 0,SQLState:null ERROR:
org.hibernate.engine.jdbc.spi.SqlExceptionHelper - 无法创建 PoolableConnectionFactory(拒绝访问用户' root' @' localhost' (使用密码:是))
警告: org.springframework.web.context.support.XmlWebApplicationContext - 上下文初始化期间遇到异常 - 取消 刷新尝试: org.springframework.beans.factory.BeanCreationException:
错误 创建名为' sessionFactory'的bean在ServletContext中定义 资源[/WEB-INF/spring/appServlet/dao-context.xml]:调用 init方法失败;嵌套异常是 org.hibernate.exception.GenericJDBCException:无法打开JDBC
dataSource配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<context:property-placeholder location="/WEB-INF/props/jdbc.properties" />
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<context:annotation-config></context:annotation-config>
<context:component-scan base-package="kr.ac.hansung.cse.dao">
</context:component-scan>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="packagesToScan">
<list>
<value>kr.ac.hansung.cse.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>
jdbc属性文件
jdbc.username=root
jdbc.password=root
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/estore
我无法在春天打开JDBC连接。 我该如何修理它们?