我的日常

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

动态微博

查看: 878|回复: 0

求助spring4整合hibernate4配置

[复制链接]

4

主题

0

听众

130

金钱

三袋弟子

该用户从未签到

跳转到指定楼层
楼主
发表于 2016-08-31 21:10:11 |只看该作者 |倒序浏览
今天刚换了4的版本就报错,纠结啊,求助  }( O5 O2 u) A$ b/ n
org.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:
# a+ A) ^( R- O& {
  u( r, o3 ~4 i1 U1 L) Y  u; @这是我spring配置信息:
3 j" L* Q% `/ O; o6 Z9 l1 i( u1 s, I8 X& |- B
<?xml version="1.0" encoding="UTF-8"?>
  z% Q# c8 d( T; F9 A* r! F<beans xmlns="http://www.springframework.org/schema/beans"# v( W/ W2 l% v, `
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"3 n+ g- S/ G  I$ m' b4 R# l1 V
        xmlns:aop="http://www.springframework.org/schema/aop"
3 R; h7 G( {' w1 f; U: ^& V        xmlns:context="http://www.springframework.org/schema/context". G- t, Q' C. V6 n0 m9 E
        xmlns:p="http://www.springframework.org/schema/p"
2 ?5 O) P- j% l, d! b6 j        xmlns:tx="http://www.springframework.org/schema/tx"" L; L1 Q0 j+ M) h. a
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
" W  y1 K  s5 N4 o                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
; `9 ~1 y' Y- X                http://www.springframework.org/schema/context http://www.springframework.org/s ... ing-context-4.0.xsd
  X' h  r+ c# z2 X$ X; K                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
$ j! T7 _, U  l: `1 j- m* _. L" [5 J% }
        <!-- 配置连接池数据源 -->$ ]% H' V# p4 l& |" Z: r
        <!-- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
0 z+ [* m7 l$ t) p2 W, R0 Z                 <property name="jndiName">
6 v8 \, e9 l1 v0 a; W- `" y                         <value>java:comp/env/jdbc/oracle</value>
5 c0 {  X+ Z4 x9 }. V# s$ D/ A                 </property>2 Y3 m+ Z; i$ |2 B* c
        </bean> -->  Q2 Y. R# M4 \/ v. \7 d, D
        <!-- 使用外部文件配置数据源 -->
* q: e) i* r1 h7 K# u  P4 M. ^         <bean id="config" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
( n" f2 j9 o" t; f                 <property name="location">/ P' T7 W5 x* K+ f' r- G3 s0 a
                        <value>classpath:jdbc.properties</value>6 \( {1 L( J0 {" j# I
                </property>
8 s( F: K- F6 X/ S2 s9 l1 n         </bean>
- Y! |0 y/ q6 {! B         <bean id="Source" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >: n; o2 }8 n: d$ I5 d. m
                <property name="driverClassName" value="${driver}"/>- F7 G, Z! A8 [3 f: s
                <property name="url" value="${url}"/>
& Z, P5 `( d8 z2 ^1 d8 t% z                 <property name="username" value="${username}"/>
% L, \1 G/ p8 h                 <property name="password" value="${password}"/>
0 ~# f# Q  T" P4 w  x+ |7 h         </bean>% z0 J" E3 L6 E( j7 {. k. I4 t
       
: Y& A* k2 }3 X; k3 a; p' j6 b         <!-- 配置session工厂 -->
& P' T( T- p9 p, b7 ]         <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
$ w! \. A. U% P3 k                 <property name="dataSource" ref="Source"></property>- a1 `$ [8 c# R; Q4 ]7 a
                <property name="hibernateProperties">. t9 x2 k/ x0 s
                        <props>
* C+ F" n0 L2 V( @! S, C& X                                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>. O5 c  e, a/ L+ [
                                <prop key="hibernate.current_session_context_class">7 ^! H9 D- M, R
                                org.springframework.orm.hibernate4.SpringSessionContext+ `& J9 S+ e' V' C$ E9 D; G+ U( D/ n( ~
                                </prop>
6 R: A% {, q; c+ w( t0 Q                        </props>3 K! c$ d- B$ A6 X
                </property># n9 Y5 W) d0 A& ]5 J% Z# J
                <property name="mappingResources">! w- Z& S8 {: s* M+ |
                        <list>
- j; t8 s( F6 a: ^4 I1 X, O                                 <value>com/entity.Dept.hbm.xml</value>
3 e2 m5 _" H8 k' S4 |& Q& Q; D. D& I                                 <value>com/entity.Emp.hbm.xml</value>" M& c- }* _" m6 ~( p1 W* z/ I7 r
                        </list>" u/ V- M0 D' x" M7 G1 `  t
                </property>
. i5 P+ Z/ x6 O4 [: ?6 G( u         </bean>$ @- S, [$ {. |# Y3 R
       
7 u: G8 u& c! S, P: Q: O         <!-- 配置dao层bean -->
+ M8 }% T) l; Y5 C- {                 <bean id="staffDao" class="com.Dao.Impl.StaffDaoImpl">
) L1 B, O" v! P6 s' K7 r( v                         <property name="sessionfactory" ref="sessionFactory"></property>
  @. s  E. D; ^0 D                 </bean>- W4 Q8 [1 o) x* m9 T. [$ G/ _
</beans>
+ G, r+ m$ `2 \* \9 X- m' W' c. ^$ u1 b: E! t
不管是用哪种jar包的配置都是这个问题,搞不懂  求解; ]4 J& J& j1 @  G" S. U: S

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


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

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

   

关闭

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

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