S2SH 中的Spring sessionFactory注入配置问题

环境是: Struts 2.1.8.1 + Spring 3.0 + Hibernate 3.3.2GA

在配置spring 时如果是一个dao的话,就不报错,但是如果有两个dao的话就报:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
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.xsd">

<bean id="employeeDao" class="com.liutan.dao.impl.EmployeeDaoImpl" scope="singleton">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="employeeService" class="com.liutan.service.impl.EmployeeServiceImpl">
    <property name="employeeDao" ref="employeeDao"/>
</bean>
<!-- 注释掉下面两个bean就不报错!-->
<bean id="departmentDao" class="com.liutan.dao.impl.DepartmentDaoImpl" scope="singleton">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="departmentService" class="com.liutan.service.impl.DepartmentServiceImpl">
    <property name="departmentDao" ref="departmentDao"/>
</bean>


[/code]

以下是dataSource和sessionFactory的代码

[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
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.xsd">

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/winmrp"/>
    <property name="user" value="root"/>
    <property name="password" value="root"/>
    <property name="minPoolSize" value="1"/>
    <property name="maxPoolSize" value="20"/>
    <property name="maxIdleTime" value="1800"/>
    <property name="acquireIncrement" value="2"/>
    <property name="maxStatements" value="0"/>
    <property name="initialPoolSize" value="2"/>
    <property name="idleConnectionTestPeriod" value="1800"/>
    <property name="acquireRetryAttempts" value="30"/>
    <property name="breakAfterAcquireFailure" value="true"/>
    <property name="testConnectionOnCheckout" value="false"/>
</bean>

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="mappingDirectoryLocations">
        <list>
            <value>classpath:/com/liutan/bean</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.generate_statistics">true</prop>
            <prop key="hibernate.connection.release_mode">auto</prop>
            <prop key="hibernate.autoReconnect">true</prop>
            <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
            <prop key="hibernate.connection.url">jdbc:mysql://localhost:3306/winmrp</prop>
            <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
            <prop key="hibernate.connection.username">root</prop>
            <prop key="hibernate.connection.password">root</prop>
        </props>
    </property>
</bean>


[/code]

[quote]
Error creating bean with name 'departmentService' defined
[/quote]
一直以为错误在dao,原来是service有问题,检查下departmentService吧,别告诉我说departmentService你也继承了HibernateDaoSupport :evil:

你有个DAO没有继承HibernateDaoSupport吧..

好像没看见事务管理器

[code="xml"]
class="org.springframework.orm.hibernate3.HibernateTransactionManager">


[/code]

先把 web.xml 贴出来瞧瞧

web.xml 倒是没问题唉,感觉好像departmentDao没认出sessionFactory的样子,检查下文件名及路径都匹配classpath:applicationContext-*.xml吗,不行内容先复制在一起试试

能吧错误信息贴完整吗