| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1161 人关注过本帖
标题:Spring配置文件的问题
只看楼主 加入收藏
lfw
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2008-4-6
结帖率:100%
收藏
 问题点数:0 回复次数:2 
Spring配置文件的问题
[bo]提示错误 :
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.lfw.sh.manager.impl.UserManagerImpl#10b4b2f' defined in class path resource [applicationContext-commom.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required
java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required[/bo]

Spring配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.
<beans>
    <bean id="dataSource"
        class="org.
        <property name="driverClassName"
            value="com.mysql.jdbc.Driver">
        </property>
        <property name="url" value="jdbc:mysql://localhost:3306/test"></property>
        <property name="username" value="root"></property>
        <property name="password" value="88888888"></property>
    </bean>
    
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>
                <prop key="hibernate.show_sql">
                    true
                </prop>
            </props>
        </property>
        <property name="mappingResources">
            <list>
                <value>com/lfw/sh/domin/User.hbm.xml</value>
                </list>
        </property></bean>
    
    
    <!--Hibernate TransactionManager-->
    <bean id="transactionManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
 
   <!--Base TransactionProxyed Service Bean-->
    <bean id="baseTxService"
          class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
          abstract="true">
        <property name="transactionManager" ref="transactionManager"/>
        <property name="proxyTargetClass" value="true"/>
           
        <property name="transactionAttributes">
            <props>
                <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="save*">PROPAGATION_REQUIRED</prop>
                <prop key="update*">PROPAGATION_REQUIRED</prop>
                <prop key="updateBillSeq*">PROPAGATION_REQUIRED,ISOLATION_SERIALIZABLE</prop>
                <prop key="remove*">PROPAGATION_REQUIRED</prop>
                <prop key="submit*">PROPAGATION_REQUIRED</prop>
            </props>
        </property>
    </bean>

    
    
     <bean id="userManager" parent="baseTxService">
        <property name="target">
            <bean class="com.lfw.sh.manager.impl.UserManagerImpl"  />
        </property>
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
    </bean>
    </beans>
搜索更多相关主题的帖子: Spring 文件 
2008-08-06 14:53
jfei
Rank: 4
来 自:郑州
等 级:业余侠客
帖 子:92
专家分:268
注 册:2011-8-27
收藏
得分:0 
'com.lfw.sh.manager.impl.UserManagerImpl#10b4b2f' defined in class path resource
 [applicationContextcommom.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required
java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required

Initialization of bean failed;初始化bean,失败,原因,
   <bean id="userManager" parent="baseTxService">
        <property name="target">
            <bean class="com.lfw.sh.manager.impl.UserManagerImpl"  />
        </property>
        <property name="sessionFactory">
            <ref bean="sessionFactory"/>
        </property>
    </bean>
userManager看看这里面有没有father方法

虾米们!!!有意者加QQ 2434202652,2632939128联系我
2012-03-09 17:28
高寒
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2005-10-25
收藏
得分:0 
com.lfw.sh.manager.impl.UserManagerImpl这个类中必须要有sessionFactory属性,查看一下你的代码中是否sessionFactory,并且还要有对应的set方法

2012-05-11 15:38
快速回复:Spring配置文件的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030393 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved