科帮网

登录/注册
您现在的位置:论坛 盖世程序员(我猜到了开头 却没有猜到结局) 盖世程序员 > 求助spring4整合hibernate4配置
总共48087条微博

动态微博

查看: 896|回复: 0

求助spring4整合hibernate4配置

[复制链接]

4

主题

0

听众

130

金钱

三袋弟子

该用户从未签到

跳转到指定楼层
楼主
发表于 2016-08-31 21:10:11 |只看该作者 |倒序浏览
今天刚换了4的版本就报错,纠结啊,求助
: ?# ]5 f1 Z" _4 Torg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Source' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
) [' t: Q0 I0 s+ i+ z
1 J' K$ {) v# [1 ^7 g( Z1 Y这是我spring配置信息:
5 P' z) _) ^7 B# E) w  T% g+ l# u0 F7 f! f! u7 I  i# b
<?xml version="1.0" encoding="UTF-8"?>7 o1 W" ^# v  n; ^$ c# `8 q, p
<beans xmlns="http://www.springframework.org/schema/beans": b. H0 ^5 x! m( d5 Y
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  t- {- |$ k4 t! R; X9 K
        xmlns:aop="http://www.springframework.org/schema/aop"& x- d" Y& P2 T9 y! x
        xmlns:context="http://www.springframework.org/schema/context"8 ]5 ~. }+ G8 c, [
        xmlns:p="http://www.springframework.org/schema/p"9 G# Y& W. G$ g! Y# V
        xmlns:tx="http://www.springframework.org/schema/tx") p3 p2 Z. c8 y- i$ b3 u# |  F
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
: s% Y) P2 `( n                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd9 `; u' C* s- s( i' Y: f
                http://www.springframework.org/schema/context http://www.springframework.org/s ... ing-context-4.0.xsd
2 S2 ]* `& T8 \. z$ o; d( d                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">5 {' \; @# G$ x* b, W" a8 Q

! n/ h) J2 ?) S1 W         <!-- 配置连接池数据源 -->7 p5 S/ c4 ]# b, y2 J3 H! X+ z
        <!-- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
1 k$ A* M. D2 O6 o- ?9 g3 {                 <property name="jndiName">9 u* G' q  Q8 H0 w9 U4 J
                        <value>java:comp/env/jdbc/oracle</value>
1 i; \  k0 b3 a/ j- B                 </property>' \( B5 [+ Z6 h; A! n) e
        </bean> -->0 d7 d# E/ \7 M7 K8 O% {
        <!-- 使用外部文件配置数据源 -->
' \3 @6 w! e9 U' m3 A4 U         <bean id="config" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">: S# M2 E- a  `' D0 U; p
                <property name="location">
* N, k' W: \" V5 @5 N3 [; J                         <value>classpath:jdbc.properties</value>( Z3 E2 j0 F" M! c. v$ V
                </property>
: W; H$ z. H% l% H: p, f         </bean>
/ E8 D; T% r5 \5 p         <bean id="Source" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >* ?5 r, q/ R- `  u) f% f% h0 t3 _
                <property name="driverClassName" value="${driver}"/>  X) f# j8 V6 {3 s* l7 e
                <property name="url" value="${url}"/>, a- l. w5 ?; o) [
                <property name="username" value="${username}"/>9 s! Y5 T, v% S1 o: l! C) R$ F
                <property name="password" value="${password}"/>: V) @0 \7 w7 l0 n) ]+ V: G
        </bean>
3 y2 o2 z% F* N, }        
0 g: u! ~5 Y6 [! p$ S3 _         <!-- 配置session工厂 -->
: A$ p. t/ L1 K; y( a/ u         <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"># g8 G( Z7 v1 ~) }/ q, Y
                <property name="dataSource" ref="Source"></property>
& [. S* O& V& V) Q# K) }6 q                 <property name="hibernateProperties">* j! C  s7 D0 `
                        <props>
7 |' f3 ^* E. A' H; \                                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
1 U0 r9 k% l1 ^' ~6 a. w. ?                                <prop key="hibernate.current_session_context_class">2 g' q; e$ f( X
                                org.springframework.orm.hibernate4.SpringSessionContext8 ^& {+ @' G' Y8 Z8 e
                                </prop>
- T" j7 g6 d9 x; y8 g9 i                        </props>
8 f6 V* l- N+ o8 c                 </property>
+ e0 V9 p2 a3 C3 E/ ?6 i                 <property name="mappingResources">' `2 t( D+ V& I+ ~% @9 a2 O
                        <list>
: z1 h! E+ A7 w# Z4 A) I& q                                 <value>com/entity.Dept.hbm.xml</value>
+ [% z$ U# A  x                                 <value>com/entity.Emp.hbm.xml</value>! d3 P0 k$ L! F6 L3 ~8 u
                        </list>
( `8 E0 K" D2 J8 Q                 </property>
6 M: }- K6 ?  r5 q- V         </bean>
5 H. Y$ A" `3 Y        
6 j/ G$ H: J- G9 x2 W: o         <!-- 配置dao层bean -->
1 \6 s; k" o4 l4 N. M/ w3 o                 <bean id="staffDao" class="com.Dao.Impl.StaffDaoImpl">1 o- E- S& t0 c0 i* T
                        <property name="sessionfactory" ref="sessionFactory"></property>+ V4 f: V$ M  b- w7 S$ n
                </bean>. b5 d7 a$ ~, d1 e$ u
</beans>% [5 _  s. O. v
/ o. J+ c9 W2 v( k. c4 {) E3 z* P
不管是用哪种jar包的配置都是这个问题,搞不懂  求解' D- Q& H) I" B

科帮网 1、本主题所有言论和图片纯属会员个人意见,与本社区立场无关
2、本站所有主题由该帖子作者发表,该帖子作者与科帮网享有帖子相关版权
3、其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和科帮网的同意
4、帖子作者须承担一切因本文发表而直接或间接导致的民事或刑事法律责任
5、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
6、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
7、科帮网管理员和版主有权不事先通知发贴者而删除本文


JAVA爱好者①群:JAVA爱好者① JAVA爱好者②群:JAVA爱好者② JAVA爱好者③ : JAVA爱好者③

快速回复
您需要登录后才可以回帖 登录 | 立即注册

   

关闭

站长推荐上一条 /1 下一条

发布主题 快速回复 返回列表 联系我们 官方QQ群 科帮网手机客户端
快速回复 返回顶部 返回列表