我在搭建一个测试SSH结构的小例子。启动tomcat的时候总是报错。不知道怎么改,希望大家指教一下。错误信息:
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'empDao' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'SessionFactory' of bean class [andyWebTestSpringDao.EmpHome]: No property 'SessionFactory' foundandyWebTestSpringDao.EmpHome继承自"HibernateDaoSupport".

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="SessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="configLocation"
    value="classpath:hibernate.cfg.xml">
    </property>
    </bean>
    <bean id="empDao" class="andyWebTestSpringDao.EmpHome">
    <property name="SessionFactory">
    <ref bean="SessionFactory" />
    </property>
    </bean>
    <bean name="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="SessionFactory" ref="SessionFactory" />
    </bean> <bean name="empproxy"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="proxyTargetClass" value="true"></property>
    <property name="transactionManager">
    <ref bean="transactionManager" />
    </property>
    <property name="target" ref="empDao"></property>
    <property name="transactionAttributes">
    <props>
    <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="get*">PROPAGATION_REQUIRED</prop>
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="delete*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean> <bean name="/login" class="andyWebTestAction.LoginAction">
    <property name="dao" ref="empproxy"></property>
    </bean>
    </beans>
      

  2.   

    我晕,是不是我的"SessionFactory"的大小写的问题。我试试先!
      

  3.   

    <property name="SessionFactory">
    你在dao类中的属性应该是小写开头的 这个是Dao中的属性 要一致