SSH整合问题!郁闷啦!

关于struts2.0.14 +spring2.5 +hibernate3.2整合的问题!tomcat6.0
望高人给解块下!

1: Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager';

2:Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext-common.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory';

3:Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

主要是这三个异常,好像是一类吧,不知道是spring2.5少加了那些包,还是什么的
我的spring2.5加入的包就是这三个spring.jar, aspectjrt.jar, aspectweaver.ar ;是不是少了东西了,还是与hibernate3.2有冲突的包;

applicationContext-common.xml配置如下:

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- 用DBCP数据库连接波来配置hibernate数据库连接 -->
class="org.apache.commons.dbcp.BasicDataSource">
value="com.mysql.jdbc.Driver">



</bean>
<!-- 配置sessionFactory  -->
<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>
            <prop key="format_sql">true</prop>
        </props>
    </property>
    <property name="mappingResources">
        <list>
            <value></value>
        </list>
    </property>
</bean>
<!-- 配置hibernate事物让spring来管理 -->
<bean id="transactionManager" 
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
        <ref local="sessionFactory"/>
      </property>
</bean>
<!-- 配置事物的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="add*" propagation="REQUIRED" />
        <tx:method name="delete*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="*" read-only="true" />
    </tx:attributes>
</tx:advice>
<!-- 那些类的那些方法需要事物; -->
<aop:config>
    <aop:pointcut id="allManagerMethod"
        expression="execution(* com.struts2.service.*.*(..))" />
    <aop:advisor pointcut-ref="allManagerMethod"
        advice-ref="txAdvice" />
</aop:config>

用的DBCP连接池,包以加入;

我以为是hibernate3.2少加入了jar包,把hibernate3.2 lib下所有的jar 都导入了,还是一样!把hiberater3.2有冲突的包也都
删了!也不行,弄了一天了.还没有整合好!高手们给小弟解块下吧!

2个回答

你的配置:




错误log:Could not parse mapping document from input stream
问题就在于你的mappingResources的列表为空;

你不改变下 代码颜色 还真是不想看

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问