为了账号安全,请及时绑定邮箱和手机立即绑定

java Web项目关于hibernate整合Spring编译报错?

java Web项目关于hibernate整合Spring编译报错?

快乐学习520 2016-07-28 20:29:35
项目编译时报错,下面给的是控制台报错内容,看不懂报的是什么错,感觉是Spring容器sessionFactory出的错,下面也给了applicationContext.xml配置,求大神指导下!谢谢报错内容:严重: Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method)applicationContext.xml配置内容<?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:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">    <!-- 配置SessionFactory -->  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" > <ref local="dataSource"/> </property> <!-- 配置Hibernate的属性 --> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <!-- 指定HIbernate映射文件的路径 --> <property name="mappingResources"> <list> <value>com/integration/entity/User.hbm.xml</value> </list> </property>  </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value> </property> <property name="url"> <value>jdbc:sqlserver://localhost:1433;DatabaseName=shuihu </value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value>wu520zeng</value> </property> </bean>     <bean id="userDAO" class="com.integration.dao.UserDAOImpl" abstract="false" lazy-init="default" autowire="default"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean>   <bean id="userService" class="com.integration.service.UserServiceImpl"> <property name="userDAO" ref="userDAO"></property> </bean>   <bean id="userAction" class="com.integration.action.UserAction">   <property name="userService" ref="userService"></property> </bean> <bean id="loginAction" class="com.integration.action.LoginAction"> <property name="userService" ref="userService"></property> </bean>   <bean id="userDeleteAction" class="com.integration.action.UserDeleteAction"> <property name="userService" ref="userService"></property> </bean>   <bean id="userQueryAction" class="com.integration.action.UserQueryAction"> <property name="userService" ref="userService"></property> </bean>   <bean id="userUpdateAction" class="com.integration.action.UserUpdateAction"> <property name="userService" ref="userService"></property> </bean></beans>
查看完整描述

1 回答

?
呵呵呵呵加呵呵呵

TA贡献14条经验 获得超8个赞

dataSource怎么配的?

查看完整回答
反对 回复 2016-07-30
  • 1 回答
  • 0 关注
  • 1592 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信